Mercurial > otakunoraifu
comparison xlovesys.cc @ 53:ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
* ParseMoji moved to TextStream
* Some cleaning (0 -> NULL when needed, removal of useless returns, ...)
author | thib |
---|---|
date | Sun, 19 Apr 2009 11:44:05 +0000 |
parents | 15a18fbe6f21 |
children | 4416cfac86ae |
comparison
equal
deleted
inserted
replaced
52:15a18fbe6f21 | 53:ddbcbd000206 |
---|---|
56 | 56 |
57 | 57 |
58 extern "C" int main(int argc, char* argv[]); /* SDL.h で定義されるので必要ないはずなんだけど…… */ | 58 extern "C" int main(int argc, char* argv[]); /* SDL.h で定義されるので必要ないはずなんだけど…… */ |
59 | 59 |
60 int main(int argc, char *argv[]) { | 60 int main(int argc, char *argv[]) { |
61 AyuSysConfig config; | 61 AyuSysConfig *config = AyuSysConfig::GetInstance(); |
62 int opt = 0, end = 0, screenmode = 0; | 62 int opt = 0, end = 0, screenmode = 0; |
63 char rootPath[1024] = "/mnt/KEY/CLANNAD"; | 63 char rootPath[1024] = "/mnt/KEY/CLANNAD"; |
64 char font[1024] = "msgothic.ttc"; | 64 char font[1024] = "msgothic.ttc"; |
65 char* xor_key = NULL; | 65 char* xor_key = NULL; |
66 Uint32 videoOptions = SDL_HWSURFACE; | 66 Uint32 videoOptions = SDL_HWSURFACE; |
111 printf(" Locale : %s\n", setlocale(LC_ALL, "")); | 111 printf(" Locale : %s\n", setlocale(LC_ALL, "")); |
112 printf(" Root Path : %s\n", rootPath); | 112 printf(" Root Path : %s\n", rootPath); |
113 printf(" Font : %s\n", font); | 113 printf(" Font : %s\n", font); |
114 printf("\n"); | 114 printf("\n"); |
115 | 115 |
116 file_searcher.InitRoot(rootPath); | 116 FileSearcher::GetInstance()->InitRoot(rootPath); |
117 config.LoadInitFile(); | 117 config->LoadInitFile(); |
118 const char* regname = config.GetParaStr("#REGNAME"); | 118 const char* regname = config->GetParaStr("#REGNAME"); |
119 if (strcmp(regname, key_lb_orig) == 0) { // "リトルバスターズ! -> LittleBustersに#REGNAMEを変更 | 119 if (strcmp(regname, key_lb_orig) == 0) { // "リトルバスターズ! -> LittleBustersに#REGNAMEを変更 |
120 config.SetParaStr("#REGNAME", key_lb_new); | 120 config->SetParaStr("#REGNAME", key_lb_new); |
121 } | 121 } |
122 if (xor_key == NULL) | 122 if (xor_key == NULL) |
123 key_holder.GuessKey((char*)regname); | 123 KeyHolder::GetInstance()->GuessKey((char*)regname); |
124 else { | 124 else { |
125 key_holder.SetKey2(xor_key); | 125 KeyHolder::GetInstance()->SetKey2(xor_key); |
126 delete[] xor_key; | 126 delete[] xor_key; |
127 } | 127 } |
128 SetFont(font); | 128 SetFont(font); |
129 | 129 |
130 MuSys mu(config); | 130 MuSys::GetInstance()->InitMusic(); |
131 mu.InitMusic(); | |
132 | 131 |
133 if(SDL_Init(SDL_INIT_VIDEO)) { | 132 if(SDL_Init(SDL_INIT_VIDEO)) { |
134 printf("Unable to init SDL: %s\n", SDL_GetError()); | 133 printf("Unable to init SDL: %s\n", SDL_GetError()); |
135 return 1; | 134 return 1; |
136 } | 135 } |
137 | 136 |
138 config.GetParam("#SCREENSIZE_MOD", 1, &screenmode); | 137 config->GetParam("#SCREENSIZE_MOD", 1, &screenmode); |
139 if (screenmode == 1) { | 138 if (screenmode == 1) { |
140 SDL_SetVideoMode(800, 600, 0, videoOptions); | 139 SDL_SetVideoMode(800, 600, 0, videoOptions); |
141 } else { | 140 } else { |
142 SDL_SetVideoMode(640, 480, 0, videoOptions); | 141 SDL_SetVideoMode(640, 480, 0, videoOptions); |
143 } | 142 } |
146 | 145 |
147 System::Main main_sys; | 146 System::Main main_sys; |
148 PicContainer* main_panel = main_sys.root.create_node(Rect(0, 0, main_sys.root.width, main_sys.root.height), 0); | 147 PicContainer* main_panel = main_sys.root.create_node(Rect(0, 0, main_sys.root.width, main_sys.root.height), 0); |
149 main_panel->show(); | 148 main_panel->show(); |
150 try { | 149 try { |
151 Scn2k scn(main_sys.event, *main_panel, mu, config); | 150 Scn2k scn(main_sys.event, *main_panel); |
152 main_sys.Mainloop(); | 151 main_sys.Mainloop(); |
153 } catch(...) { | 152 } catch(...) { |
154 fprintf(stderr,"System faulted; exit now.\n"); | 153 fprintf(stderr,"System faulted; exit now.\n"); |
155 } | 154 } |
156 delete main_panel; | 155 delete main_panel; |
157 | 156 |
158 | 157 MuSys::Quit(); |
159 mu.FinalizeMusic(); | 158 KeyHolder::Quit(); |
159 AyuSysConfig::Quit(); | |
160 FileSearcher::Quit(); | |
160 | 161 |
161 SDL_Quit(); | 162 SDL_Quit(); |
162 } | 163 } |
163 | 164 |