comparison xlovesys.cc @ 52:15a18fbe6f21

* Known bugs added to the README * Code cleaning (0 -> NULL when needed, indentation, spaces, ...)
author thib
date Sat, 18 Apr 2009 18:35:39 +0000
parents cbb301016a4e
children ddbcbd000206
comparison
equal deleted inserted replaced
51:cbb301016a4e 52:15a18fbe6f21
29 // #define ROOTPATH "/home/uenok/pb" 29 // #define ROOTPATH "/home/uenok/pb"
30 // #define FONT "msgothic.ttc" 30 // #define FONT "msgothic.ttc"
31 /* kochi-mincho-subst.ttf あるいは -*-*-*-r-*--24-*-*-*-*-*-jisx0208.1983-* など */ 31 /* kochi-mincho-subst.ttf あるいは -*-*-*-r-*--24-*-*-*-*-*-jisx0208.1983-* など */
32 /* TrueType Font は /usr/X11R6/lib/X11/fonts/TrueType/ などに存在する必要がある */ 32 /* TrueType Font は /usr/X11R6/lib/X11/fonts/TrueType/ などに存在する必要がある */
33 33
34 #include<stdio.h> 34 #include <stdio.h>
35 #include<stdlib.h> 35 #include <stdlib.h>
36 #include<unistd.h> 36 #include <unistd.h>
37 #include<locale.h> 37 #include <locale.h>
38 38
39 #include<SDL.h> 39 #include <SDL.h>
40 #include<vector> 40 #include <vector>
41 #include<getopt.h> 41 #include <getopt.h>
42 42
43 #include"system/file.h" 43 #include "system/file.h"
44 #include"system/system_config.h" 44 #include "system/system_config.h"
45 #include"window/widget.h" 45 #include "window/widget.h"
46 #include"window/system.h" 46 #include "window/system.h"
47 47
48 #include"music2/music.h" 48 #include "music2/music.h"
49 49
50 #include"scn2k/scn2k.h" 50 #include "scn2k/scn2k.h"
51 #include"scn2k/scn2k_impl.h" 51 #include "scn2k/scn2k_impl.h"
52 52
53 const char key_lb_orig[] = {0x4b, 0x45, 0x59, 0x5c, 0x83, 0x8a, 0x83, 0x67, 0x83, 0x8b, 0x83, 0x6f, 0x83, 0x58, 0x83, 0x5e, 0x81, 0x5b, 0x83, 0x59, 0x81, 0x49, 0}; 53 const char key_lb_orig[] = {0x4b, 0x45, 0x59, 0x5c, 0x83, 0x8a, 0x83, 0x67, 0x83, 0x8b, 0x83, 0x6f, 0x83, 0x58, 0x83, 0x5e, 0x81, 0x5b, 0x83, 0x59, 0x81, 0x49, 0};
54 54
55 const char key_lb_new[] = "KEY\\LittleBusters"; 55 const char key_lb_new[] = "KEY\\LittleBusters";
56 56
110 printf("Settings:\n"); 110 printf("Settings:\n");
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 file_searcher.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);
130 MuSys mu(config); 130 MuSys mu(config);
131 mu.InitMusic(); 131 mu.InitMusic();
132 132
133 if(SDL_Init(SDL_INIT_VIDEO)) { 133 if(SDL_Init(SDL_INIT_VIDEO)) {
134 printf("Unable to init SDL: %s\n", SDL_GetError()); 134 printf("Unable to init SDL: %s\n", SDL_GetError());
135 return 1; 135 return 1;
136 } 136 }
137 137
138 config.GetParam("#SCREENSIZE_MOD", 1, &screenmode); 138 config.GetParam("#SCREENSIZE_MOD", 1, &screenmode);
139 if (screenmode == 1) { 139 if (screenmode == 1) {
140 SDL_SetVideoMode(800, 600, 0, videoOptions); 140 SDL_SetVideoMode(800, 600, 0, videoOptions);
141 } else { 141 } else {
142 SDL_SetVideoMode(640, 480, 0, videoOptions); 142 SDL_SetVideoMode(640, 480, 0, videoOptions);
143 } 143 }
144 // SDL_SetVideoMode(640, 480, 0, videoOptions); 144 // SDL_SetVideoMode(640, 480, 0, videoOptions);
145 // SDL_SetVideoMode(800, 600, 0, SDL_HWSURFACE /*| SDL_FULLSCREEN */); 145 // SDL_SetVideoMode(800, 600, 0, SDL_HWSURFACE /*| SDL_FULLSCREEN */);
146 { 146
147 System::Main main_sys; 147 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); 148 PicContainer* main_panel = main_sys.root.create_node(Rect(0, 0, main_sys.root.width, main_sys.root.height), 0);
149 main_panel->show(); 149 main_panel->show();
150 try { 150 try {
151 Scn2k scn(main_sys.event, *main_panel, mu, config); 151 Scn2k scn(main_sys.event, *main_panel, mu, config);
152 main_sys.Mainloop(); 152 main_sys.Mainloop();
153 } catch(...) { 153 } catch(...) {
154 fprintf(stderr,"System faulted; exit now.\n"); 154 fprintf(stderr,"System faulted; exit now.\n");
155 }
156 delete main_panel;
157 } 155 }
156 delete main_panel;
157
158 158
159 mu.FinalizeMusic(); 159 mu.FinalizeMusic();
160 160
161 SDL_Quit(); 161 SDL_Quit();
162 } 162 }