aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorspicyjpeg <thatspicyjpeg@gmail.com>2023-01-22 15:40:14 +0100
committerspicyjpeg <thatspicyjpeg@gmail.com>2023-01-22 15:40:14 +0100
commita21e949c9aea98cb4b3feee48bb98579bbdfba70 (patch)
tree5fad8655bc674bebdbecb385d3e4878acbac3597 /examples
parent3095b4571dabc8d6cee90673d679f3e77b21b164 (diff)
downloadpsn00bsdk-a21e949c9aea98cb4b3feee48bb98579bbdfba70.tar.gz
Fix VSync(), assert(), warnings and some examples
Diffstat (limited to 'examples')
-rw-r--r--examples/demos/n00bdemo/main.c14
-rw-r--r--examples/graphics/billboard/billboard.c2
-rw-r--r--examples/io/system573/iso.xml8
-rw-r--r--examples/system/childexec/child/child.c7
-rw-r--r--examples/system/childexec/parent.c22
5 files changed, 22 insertions, 31 deletions
diff --git a/examples/demos/n00bdemo/main.c b/examples/demos/n00bdemo/main.c
index 6d0be3c..c9ca3ce 100644
--- a/examples/demos/n00bdemo/main.c
+++ b/examples/demos/n00bdemo/main.c
@@ -624,7 +624,7 @@ void plasmastuff() {
// Simple stripe transition effect
void transition() {
- int i,count,comp;
+ int count = 0;
int bheight[16] = { 0 };
TILE *tile = (TILE*)nextpri;
@@ -632,9 +632,9 @@ void transition() {
while( 1 ) {
- comp = 0;
+ int comp = 0;
- for( i=0; i<16; i++ ) {
+ for( int i=0; i<16; i++ ) {
if( bheight[i] > 0 ) {
@@ -657,19 +657,11 @@ void transition() {
if( bheight[count>>1] == 0 )
bheight[count>>1] = 1;
-
display();
count++;
if( comp >= 16 )
break;
-
- /*
- I haven't yet managed to figure out why this loop hangs on no$psx
- if I comment out this completely useless call to puts(). Some
- alignment or timing crap perhaps? -- spicyjpeg
- */
- puts(".");
}
DrawSync(0);
diff --git a/examples/graphics/billboard/billboard.c b/examples/graphics/billboard/billboard.c
index ea98b28..1ddc4dc 100644
--- a/examples/graphics/billboard/billboard.c
+++ b/examples/graphics/billboard/billboard.c
@@ -152,7 +152,7 @@ int main() {
setRGB0(quad, 128, 128, 128);
// Set tpage
- quad->tpage = getTPage(tim.mode&0x8, 0, tim.prect->x, tim.prect->y);
+ quad->tpage = getTPage(tim.mode, 0, tim.prect->x, tim.prect->y);
// Set CLUT
setClut(quad, tim.crect->x, tim.crect->y);
diff --git a/examples/io/system573/iso.xml b/examples/io/system573/iso.xml
index 2226089..c960b8a 100644
--- a/examples/io/system573/iso.xml
+++ b/examples/io/system573/iso.xml
@@ -19,9 +19,9 @@
The System 573 BIOS does not parse SYSTEM.CNF, it's instead
hardcoded to look for an executable named PSX.EXE. Some modded
or hacked BIOS variants may instead look for slightly altered
- file names (QSY.DXD, SSW.BXF, TSV.AXG) as an obfuscation
- measure, so it's recommended to have multiple copies of the
- executable on the disc.
+ file names (QSY.DXD, SSW.BXF, TSV.AXG, GSE.NXX, NSE.GXX) as an
+ obfuscation measure, so it's recommended to have multiple
+ copies of the executable on the disc.
Note that this behavior can be abused to make multi-system CDs
with different executables for PS1 and 573 (i.e. have both
@@ -33,6 +33,8 @@
<file name="QSY.DXD" type="data" source="system573.exe" />
<file name="SSW.BXF" type="data" source="system573.exe" />
<file name="TSV.AXG" type="data" source="system573.exe" />
+ <file name="GSE.NXX" type="data" source="system573.exe" />
+ <file name="NSE.GXX" type="data" source="system573.exe" />
<dummy sectors="1024"/>
</directory_tree>
diff --git a/examples/system/childexec/child/child.c b/examples/system/childexec/child/child.c
index dcfbfaf..b52dd32 100644
--- a/examples/system/childexec/child/child.c
+++ b/examples/system/childexec/child/child.c
@@ -238,11 +238,12 @@ int main(int argc, const char *argv[]) {
display();
}
-
+
+ DrawSync(0);
StopPAD();
-
+ StopCallback();
+
return 0;
-
}
void init(void) {
diff --git a/examples/system/childexec/parent.c b/examples/system/childexec/parent.c
index 83d964c..79c81f1 100644
--- a/examples/system/childexec/parent.c
+++ b/examples/system/childexec/parent.c
@@ -285,31 +285,27 @@ void run_child(void) {
// Copy child executable to its intended adddress
memcpy((void*)exe->param.t_addr, child_exe+2048, exe->param.t_size);
-
- // Prepare for program execution and disable interrupts
- //EnterCriticalSection();
- StopCallback();
- // Stop pads, enable auto acknowledge
+ // Prepare for program execution and disable interrupts
+ DrawSync(0);
StopPAD();
- ChangeClearPAD(1);
- ChangeClearRCnt(3, 1);
+ StopCallback();
+ FlushCache();
// Execute child
- printf("Child exec!\n");
+ printf("Executing child...\n");
Exec(&exe->param, 3, args);
-
+
// Restore interrupts for this PS-EXE
RestartCallback();
- //ExitCriticalSection();
-
+ printf("Child returned\n");
+
// Re-init and re-enable pads
InitPAD(pad_buff[0], 34, pad_buff[1], 34);
StartPAD();
ChangeClearPAD(0);
-
+
// Set this program's display mode
SetDispMask(0);
PutDispEnv(&disp);
-
}