79void init_now_loading(
int title_number) {
82 if (now_loding_off != 0) {
88 u_char raw_archive[320000];
90 u_char raw_archive[64000];
92 u_char *archive = raw_archive;
94 int misalignment = (int) archive % 64;
96 if (misalignment != 0) {
97 archive += 64 - misalignment;
102 char image_directory[64] =
"img";
104 if (LanguageCode > LANG_JAPANESE) {
105 sprintf(image_directory,
"img_%d", LanguageCode);
110 if (title_number < 5) {
111 sprintf(path,
"%s/mt0%d.tm2", image_directory, title_number + 1);
112 }
else if (title_number < 100) {
113 sprintf(path,
"%s/mt%d.tm2", image_directory, title_number);
115 sprintf(path,
"%s/mt%d.tm2", image_directory, title_number - 99);
118 if (title_number == 0x321) {
119 sprintf(path,
"%s/title.img", image_directory);
121 if (LoadFile2(path, archive, &archive_size, 0) == 0) {
126 LoadTexture(
"SCElogo", archive, &nl_tex, 8000, 10000);
127 LoadTexture(
"L5logo", archive, &nl_tex2, 9500, 10100);
129 LoadTexture(
"SCElogo", archive, &nl_tex, 0x1A40, 10000);
130 LoadTexture(
"L5logo", archive, &nl_tex2, 8000, 0x2774);
133 if (path[0] ==
'\0') {
137 if (LoadFile2(path, archive, &archive_size, 0) == 0) {
142 LoadTexture((
TM2_head *) archive, &nl_tex, 8000, 9000);
144 LoadTexture((
TM2_head *) archive, &nl_tex, 0x1A40, 8000);
148 map_title_no = title_number;
150 sceGsSetDefDBuff(&nowloadDB, 0, 640, SCREEN_HALF_HEIGHT, 2, 0x31, 1);
151 nowloadDB.clear0.rgbaq.R = 0;
152 nowloadDB.clear0.rgbaq.G = 0;
153 nowloadDB.clear0.rgbaq.B = 0;
154 nowloadDB.clear0.rgbaq.A = 0x80;
155 nowloadDB.clear1.rgbaq.R = 0;
156 nowloadDB.clear1.rgbaq.G = 0;
157 nowloadDB.clear1.rgbaq.B = 0;
158 nowloadDB.clear1.rgbaq.A = 0x80;
159 sceVif1PkInit(&nlPacket, now_load);
165 now_loading_vsync_end = 1;
166 MGInitVSyncCallBack(VSyncCallBack_Load);
176int VSyncCallBack_Load(
int field) {
180 now_loading_vsync_end = 1;
184 VSyncField = !((*(
volatile u_long *) 0x12001000 >> 13) & 1);
186 if (nl_start_cnt == 0) {
187 sceDmaSync(DmaCH1, 0, 0);
188 sceVif1PkReset(&nlPacket);
190 if (map_title_no == 0x321) {
191 if (logo_count == 0) {
194 if (LanguageCode >= LANG_ENGLISH_UK) {
195 set2DSprite(&nlPacket, &nl_tex,
CRect_i_(0, 0x10, 0x280, 0x1C0),
CRect_i_(0, 0, 0x280, 0x1C0), (u_char) (
int) col_cnt);
197 set2DSprite(&nlPacket, &nl_tex,
CRect_i_(0x60, 0xC0, 0x1C0, 0x40),
CRect_i_(0, 0, 0x1C0, 0x40), (u_char) (
int) col_cnt);
200 set2DSprite(&nlPacket, &nl_tex,
CRect_i_(0x60, 0xC0, 0x1C0, 0x40),
CRect_i_(0, 0, 0x1C0, 0x40), (u_char) (
int) col_cnt);
204 if (logo_count == 1) {
205 set2DSprite(&nlPacket, &nl_tex2,
CRect_i_(0x100, 0xA0, 0x80, 0x80),
CRect_i_(0, 0, 0x80, 0x80), (u_char) (
int) col_cnt);
209 col_cnt += col_add * 2.0f;
212 if (col_cnt > 128.0f) {
223 if (col_cnt < 0.0f) {
232 if (logo_count == 1) {
245 set2DSprite(&nlPacket, &nl_tex,
CRect_i_(0x80, 0xA0, 0x180, 0x80),
CRect_i_(0, 0, 0x180, 0x80), (u_char) (
int) col_cnt);
251 if (col_cnt > 128.0f) {
257 if (col_cnt < 0.0f) {
269 sceVif1PkEnd(&nlPacket, 0);
270 sceVif1PkTerminate(&nlPacket);
272 sceDmaSend(DmaCH1, nlPacket.pBase);
277 if (nl_start_cnt < 0) {
281 sceGsDrawEnv1 *draw = DBuffID != 0 ? &nowloadDB.draw1 : &nowloadDB.draw0;
282 sceGsSetHalfOffset(draw, 0x800, 0x800, VSyncField);
283 iSyncDCache(&nowloadDB, (u_char *) &nowloadDB +
sizeof(nowloadDB));
284 sceGsSwapDBuff(&nowloadDB, DBuffID);
286 sceDmaSync(DmaCH2, 0, 0);
287 now_loading_vsync_end = 1;
298void LoadTexture(
char *name, u_char *archive,
CTexture *texture,
int image_address,
int palette_address) {
299 SetTextureInfo(texture, name, archive);
302 sceGsSetDefLoadImage(&load, (
short) image_address, tex0->TBW, tex0->PSM, 0, 0, texture->
width, texture->
height);
304 sceGsExecLoadImage(&load, (u_long128 *) texture->
image[0]);
306 if (texture->
bpp == 0) {
307 sceGsSetDefLoadImage(&load, (
short) palette_address, 1, 0, 0, 0, 8, 2);
310 if (texture->
bpp == 1) {
311 sceGsSetDefLoadImage(&load, (
short) palette_address, 1, 0, 0, 0, 16, 16);
316 if (texture->
bpp < 2) {
317 sceGsExecLoadImage(&load, (u_long128 *) texture->
clut);
320 tex0->TBP0 = image_address;
322 tex0->CBP = palette_address;
332void LoadTexture(
TM2_head *image,
CTexture *texture,
int image_address,
int palette_address) {
333 SetTextureInfo(texture,
"maptitle", image);
336 sceGsSetDefLoadImage(&load, (
short) image_address, tex0->TBW, tex0->PSM, 0, 0, texture->
width, texture->
height);
338 sceGsExecLoadImage(&load, (u_long128 *) texture->
image[0]);
340 if (texture->
bpp == 0) {
341 sceGsSetDefLoadImage(&load, (
short) palette_address, 1, 0, 0, 0, 8, 2);
344 if (texture->
bpp == 1) {
345 sceGsSetDefLoadImage(&load, (
short) palette_address, 1, 0, 0, 0, 16, 16);
350 if (texture->
bpp < 2) {
351 sceGsExecLoadImage(&load, (u_long128 *) texture->
clut);
354 tex0->TBP0 = image_address;
356 tex0->CBP = palette_address;