Skip to content

Commit 2cd1659

Browse files
committed
menu/pksprite: match functions
- PkNSprite_Add - PkPolyF4_Add
1 parent 618b3dd commit 2cd1659

File tree

7 files changed

+359
-498
lines changed

7 files changed

+359
-498
lines changed

include/common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ typedef float f32;
6161

6262
#define PR_BREAK() asm("break")
6363

64+
/* 3.14159265358979323846f */
6465
#define PR_PI (float)M_PI
6566

6667
#endif /* COMMON_H */

src/main/cdctrl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int PackIntDecode(u_char *fp_r, u_char *fp_w) {
4141

4242
int i, c, c1, c2;
4343

44-
asm("sync.l");
44+
asm volatile("sync.l");
4545

4646
moto_size = *(u_int*)fp_r;
4747
fp_w = (u_char*)PR_UNCACHED(fp_w);
@@ -82,7 +82,7 @@ int PackIntDecode(u_char *fp_r, u_char *fp_w) {
8282
}
8383
}
8484

85-
asm("sync.l");
85+
asm volatile("sync.l");
8686
return 0;
8787
}
8888

@@ -96,7 +96,7 @@ int PackIntDecodeWait(u_char *fp_r, u_char *fp_w, int wait_hline) {
9696
int i, c, c1, c2;
9797

9898
printf("decode moto[%08x] saki[%08x]\n", fp_r, fp_w);
99-
asm("sync.l");
99+
asm volatile("sync.l");
100100

101101
moto_size = *(u_int*)fp_r;
102102
fp_w = (u_char*)PR_UNCACHED(fp_w);
@@ -149,7 +149,7 @@ int PackIntDecodeWait(u_char *fp_r, u_char *fp_w, int wait_hline) {
149149
}
150150
}
151151

152-
asm("sync.l");
152+
asm volatile("sync.l");
153153
return 0;
154154
}
155155

src/main/effect.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,16 @@ void UG_WaveDisp(WAVE_STR *wstr, sceGsFrame *frame_pp, sceGifPacket *wavePkSpr)
8282
haba_now_u = 0;
8383
}
8484

85-
tmp_u = wstr->addU * i + wstr->u;
86-
tmp_v = wstr->addV * i + wstr->v;
85+
tmp_u = (wstr->addU * i) + wstr->u;
86+
tmp_v = (wstr->addV * i) + wstr->v;
8787
sceGifPkAddGsAD(wavePkSpr, SCE_GS_UV, SCE_GS_SET_UV((tmp_u << 4) + haba_now_u, (tmp_v << 4) + haba_now_v));
8888

89-
tmp_x = wstr->x + wstr->addW * i;
90-
tmp_y = wstr->y + wstr->addH * i;
89+
tmp_x = wstr->x + (wstr->addW * i);
90+
tmp_y = wstr->y + (wstr->addH * i);
9191
sceGifPkAddGsAD(wavePkSpr, SCE_GS_XYZ2, SCE_GS_SET_XYZ(tmp_x << 4, tmp_y << 4, 1));
9292

93-
tmp_u += (wstr->sizeW - wstr->mvSize * 2);
94-
tmp_v += (wstr->sizeH - wstr->mvSize * 2);
93+
tmp_u += wstr->sizeW - (wstr->mvSize * 2);
94+
tmp_v += wstr->sizeH - (wstr->mvSize * 2);
9595
sceGifPkAddGsAD(wavePkSpr, SCE_GS_UV, SCE_GS_SET_UV((tmp_u << 4) + haba_now_u, (tmp_v << 4) + haba_now_v));
9696
sceGifPkAddGsAD(wavePkSpr, SCE_GS_XYZ2, SCE_GS_SET_XYZ((tmp_x + wstr->sizeW) << 4, (tmp_y + wstr->sizeH) << 4, 1));
9797

@@ -374,8 +374,8 @@ void CG_NoodlesDisp(NOODLES_STR *ndl_pp, sceGsFrame *frame_pp, int pri, int time
374374

375375
void FD_MonocroDisp(MONOCRO_STR *mono_pp, int tbp, int w, int h) {
376376
u_char *dat_pp;
377-
int i, j, k;
378-
short sizew, sizeh;
377+
int i, j, k;
378+
short sizew, sizeh;
379379
u_short ctmp;
380380

381381
for (i = 0; i < h; i += 32) {

src/main/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ int selPlayDisp(int sel_stage, int sel_disp, int firstf) {
418418
CdctrlReadWait();
419419
printf("overlay module load out\n");
420420

421-
asm("sync.l");
421+
asm volatile("sync.l");
422422
FlushCache(WRITEBACK_DCACHE);
423423

424424
stdat_dat_pp = &stdat_rec[sel_stage].stdat_dat_pp[sel_disp];
@@ -561,7 +561,7 @@ int selPlayDispTitleDisp(int sel_stage, int sel_disp, int ovl_load) {
561561
printf("overlay module load out\n");
562562
}
563563

564-
asm("sync.l");
564+
asm volatile("sync.l");
565565
FlushCache(WRITEBACK_DCACHE);
566566

567567
stdat_dat_pp = &stdat_rec[sel_stage].stdat_dat_pp[sel_disp];

src/menu/memc.c

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "menu/memc.h"
2+
#include "sifdev.h"
23

34
#include <stdio.h>
45
#include <string.h>
@@ -31,9 +32,7 @@ void memc_setDirName(char *name) {
3132
}
3233

3334
void memc_setSaveTitle(char *name, int nLFPos) {
34-
int length;
35-
36-
length = strlen(name);
35+
int length = strlen(name);
3736
if (length > 64) {
3837
length = 64;
3938
}
@@ -52,7 +51,7 @@ void memc_setIconSysHed(void *pIhData, int IhSize) {
5251
}
5352

5453
nLF = memc_iconsys.OffsLF;
55-
54+
5655
memcpy(&memc_iconsys, pIhData, IhSize);
5756
memc_iconsys.OffsLF = nLF;
5857
}
@@ -64,7 +63,7 @@ void memc_setSaveIcon(int no, void *pIconData, int nIconSize) {
6463
case 0:
6564
pmw->iconData1 = pIconData;
6665
pmw->iconSize1 = nIconSize;
67-
66+
6867
strcpy(memc_iconsys.FnameView, "icon1.ico");
6968
break;
7069
case 1:
@@ -113,10 +112,12 @@ char* memc_getfilename(int no) {
113112
if (memc_stat.iconData2 == NULL) {
114113
return NULL;
115114
}
115+
/* fallthrough */
116116
case -4:
117117
if (memc_stat.iconData3 == NULL) {
118118
return NULL;
119119
}
120+
/* fallthrough */
120121
default:
121122
if (no >= 2) {
122123
return NULL;
@@ -128,6 +129,7 @@ char* memc_getfilename(int no) {
128129
sprintf(tmps0, "SAVE%03d", no);
129130
fbody = tmps0;
130131
}
132+
131133
break;
132134
}
133135

@@ -248,7 +250,7 @@ int memc_port_info(int port, MEMC_INFO *info) {
248250
strcpy(pmw->filename, pmw->saveDir);
249251
strcat(pmw->filename, "/*");
250252

251-
pmw->bChkSys = 1;
253+
pmw->bChkSys = TRUE;
252254
pmw->filename[63] = '\0';
253255

254256
memc_clearMEMCINFO(info);
@@ -257,7 +259,7 @@ int memc_port_info(int port, MEMC_INFO *info) {
257259
if (re == sceMcResSucceed) {
258260
pmw->func = MEMC_FUNC_GETINFO;
259261
}
260-
262+
261263
return re;
262264
}
263265

@@ -544,7 +546,6 @@ static int memc_mansub_ErrChk(int result) {
544546
case -2:
545547
pmw->func = 0;
546548
return 3;
547-
/* (pmw->func==1||pmw->cmd==sceMcFuncNoFileInfo) -- sceMcResNoFormat */
548549
case -2000:
549550
pmw->func = 0;
550551
pmw->isChange = 1;
@@ -641,7 +642,7 @@ static int memc_mansub_GetInfo(int result) {
641642

642643
return memc_mansub_ErrChk(re);
643644
} else {
644-
if (pmw->format == 0) {
645+
if (!pmw->format) {
645646
pmw->func = 0;
646647
return 3;
647648
} else {
@@ -711,7 +712,7 @@ static int memc_mansub_load(int result) {
711712
return 2;
712713
}
713714

714-
if (!memc_mansub_Open(pmw->filename, 1)) {
715+
if (!memc_mansub_Open(pmw->filename, SCE_RDONLY)) {
715716
pmw->func = 3;
716717
break;
717718
}
@@ -768,7 +769,7 @@ static int memc_manager_save(int result) {
768769
switch (pmw->cmd) {
769770
case 0xe:
770771
if (result == 0) {
771-
if (pmw->format == 0) {
772+
if (!pmw->format) {
772773
result = -2;
773774
}
774775
}
@@ -796,7 +797,7 @@ static int memc_manager_save(int result) {
796797

797798
case 0xd:
798799
if (result == 0) {
799-
if (pmw->format == 0) {
800+
if (!pmw->format) {
800801
result = -2;
801802
}
802803
}
@@ -851,7 +852,7 @@ static int memc_manager_save(int result) {
851852
if (isSysOWrite) {
852853
pmw->func = 4;
853854
pmw->stat |= 0x3;
854-
memc_mansub_Open(memc_getfilepath(-1), 0x202);
855+
memc_mansub_Open(memc_getfilepath(-1), SCE_CREAT | SCE_WRONLY);
855856
break;
856857
}
857858

@@ -860,7 +861,7 @@ static int memc_manager_save(int result) {
860861
pmw->func = 0;
861862
return 4;
862863
} else {
863-
if (memc_mansub_Open(pmw->filename, 0x202) == 1) {
864+
if (memc_mansub_Open(pmw->filename, SCE_CREAT | SCE_WRONLY) == 1) {
864865
pmw->func = 0;
865866
return 4;
866867
}
@@ -887,7 +888,7 @@ static int memc_manager_save(int result) {
887888
break;
888889
case 0xb:
889890
if (result == 0) {
890-
if (pmw->format == 0) {
891+
if (!pmw->format) {
891892
result = -2;
892893
}
893894
}
@@ -907,11 +908,11 @@ static int memc_manager_save(int result) {
907908

908909
pmw->func = 4;
909910
pmw->stat |= 0x2;
910-
memc_mansub_Open(memc_getfilepath(-1), 0x202);
911+
memc_mansub_Open(memc_getfilepath(-1), SCE_CREAT | SCE_WRONLY);
911912
break;
912913
case 2:
913914
if (result == 0) {
914-
if (pmw->format == 0) {
915+
if (!pmw->format) {
915916
result = -2;
916917
}
917918
}
@@ -971,7 +972,7 @@ static int memc_manager_save(int result) {
971972

972973
case 0x1000e:
973974
if (result == 0) {
974-
if (pmw->format == 0) {
975+
if (!pmw->format) {
975976
result = -2;
976977
}
977978
}
@@ -990,7 +991,7 @@ static int memc_manager_save(int result) {
990991
break;
991992
case 0x1000f:
992993
if (result == 0) {
993-
if (pmw->format == 0) {
994+
if (!pmw->format) {
994995
result = -2;
995996
}
996997
}
@@ -1011,7 +1012,7 @@ static int memc_manager_save(int result) {
10111012
break;
10121013
case 6:
10131014
if (result == 0) {
1014-
if (pmw->format == 0) {
1015+
if (!pmw->format) {
10151016
result = -2;
10161017
}
10171018
}
@@ -1045,28 +1046,28 @@ static int memc_manager_save(int result) {
10451046

10461047
if (!(pmw->stat & 0x4)) {
10471048
pmw->stat |= 0x4;
1048-
memc_mansub_Open(memc_getfilepath(-2), 0x202);
1049+
memc_mansub_Open(memc_getfilepath(-2), SCE_CREAT | SCE_WRONLY);
10491050
break;
10501051
}
10511052

10521053
if (!(pmw->stat & 0x8)) {
10531054
if ((fname = memc_getfilepath(-3)) != NULL) {
10541055
pmw->stat |= 0x8;
1055-
memc_mansub_Open(fname, 0x202);
1056+
memc_mansub_Open(fname, SCE_CREAT | SCE_WRONLY);
10561057
break;
10571058
}
10581059
}
10591060

10601061
if (!(pmw->stat & 0x10)) {
10611062
if ((fname = memc_getfilepath(-4)) != NULL) {
10621063
pmw->stat |= 0x10;
1063-
memc_mansub_Open(fname, 0x202);
1064+
memc_mansub_Open(fname, SCE_CREAT | SCE_WRONLY);
10641065
break;
10651066
}
10661067
}
10671068

10681069
pmw->stat &= ~0x1f;
1069-
memc_mansub_Open(pmw->filename, 0x202);
1070+
memc_mansub_Open(pmw->filename, SCE_CREAT | SCE_WRONLY);
10701071
} else {
10711072
pmw->func = 0;
10721073
return 1;
@@ -1107,11 +1108,11 @@ static int memc_manager_overwrite(int result) {
11071108
memc_searchDirTbl(fname, pmw->curDir, 0, 1, pmw->iconSize3, NULL) == NULL)) {
11081109
pmw->func = 4;
11091110
pmw->stat |= 0x3;
1110-
memc_mansub_Open(memc_getfilepath(-1), 0x202);
1111+
memc_mansub_Open(memc_getfilepath(-1), SCE_CREAT | SCE_WRONLY);
11111112
return 0x10;
11121113
}
11131114

1114-
if (memc_mansub_Open(pmw->filename, 0x202) == 1) {
1115+
if (memc_mansub_Open(pmw->filename, SCE_CREAT | SCE_WRONLY) == 1) {
11151116
pmw->func = 0;
11161117
return 4;
11171118
} else {
@@ -1130,7 +1131,7 @@ static int memc_manager_chk(int mode) {
11301131

11311132
pmw = &memc_stat;
11321133

1133-
re = sceMcSync(mode, 0, &result);
1134+
re = sceMcSync(mode, NULL, &result);
11341135
if (re == sceMcExecFinish) {
11351136
switch (pmw->func) {
11361137
case 3:

0 commit comments

Comments
 (0)