Skip to content

Commit

Permalink
Code cleanup 1.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wolf3s committed Nov 15, 2024
1 parent a57b9c2 commit 0df6959
Show file tree
Hide file tree
Showing 30 changed files with 1,490 additions and 615 deletions.
2 changes: 0 additions & 2 deletions ee_core/include/ee_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#include <sbv_patches.h>
#include <smem.h>
#include <smod.h>
#include <stdbool.h>


#ifdef __EESIO_DEBUG
#define DPRINTF(args...) _print(args);
Expand Down
34 changes: 17 additions & 17 deletions ee_core/src/igs_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ static u32 FindEmptyArea(u32 start, u32 end, u32 emptysize)

if (counter == emptysize) {
result = (u32)addr - emptysize;
result = (((result) >> 4) << 4); // It must be 16-bytes aligned
DBGCOL_BLNK(2, 0x00FF00, false, IGS, "FindEmptyArea(): Found"); // FOUND => Double Green :-)
result = (((result) >> 4) << 4); // It must be 16-bytes aligned
DBGCOL_BLNK(2, 0x00FF00, 0, IGS, "FindEmptyArea(): Found"); // FOUND => Double Green :-)
} else {
// result = 0x00100000; // 1st. possible workaround: Use the ingame area (Typically starts on "0x00100000"). It must be 16-bytes aligned
result = ((0x01F32568 - emptysize - 16) >> 4) << 4; // 2nd. possible workaround: Himem area ("0x01F32568" taken from PS2LINK hi-mem). It must be 16-bytes aligned
DBGCOL_BLNK(2, 0x0066FF, false, IGS, "FindEmptyArea(): Not found"); // Double Orange :-(
result = ((0x01F32568 - emptysize - 16) >> 4) << 4; // 2nd. possible workaround: Himem area ("0x01F32568" taken from PS2LINK hi-mem). It must be 16-bytes aligned
DBGCOL_BLNK(2, 0x0066FF, 0, IGS, "FindEmptyArea(): Not found"); // Double Orange :-(
}

return result;
Expand Down Expand Up @@ -161,7 +161,7 @@ static u8 PixelSize(u8 spsm)
else if ((spsm == GS_PSM_CT16) || (spsm == GS_PSM_CT16S))
result = 2;
else
DBGCOL_BLNK(1, 0x0000FF, true, IGS, "PixelSize(): Unknown?"); // Red
DBGCOL_BLNK(1, 0x0000FF, 1, IGS, "PixelSize(): Unknown?"); // Red
return result;
}

Expand Down Expand Up @@ -191,10 +191,10 @@ static void Screenshot(u16 sbp, u8 sbw, u8 spsm, u16 width, u16 height, u32 dime
u8 i;

if ((sbw < 1) || (sbw > 32))
DBGCOL_BLNK(2, 0x0000FF, true, IGS, "Screenshot(): sbw out of range [1-32]"); // Red
DBGCOL_BLNK(2, 0x0000FF, 1, IGS, "Screenshot(): sbw out of range [1-32]"); // Red

if ((height < 64) || (height > 1080))
DBGCOL_BLNK(3, 0x0000FF, true, IGS, "Screenshot(): height out of range [64-1080]"); // Red
DBGCOL_BLNK(3, 0x0000FF, 1, IGS, "Screenshot(): height out of range [64-1080]"); // Red

// Number of qwords (each qword = 2^4 bytes = 16 bytes = 128 bits)
qwords = image_size >> 4;
Expand Down Expand Up @@ -410,7 +410,7 @@ static void SaveTextFile(u32 buffer, u16 width, u16 height, u8 pixel_size, u32 i
// Create file
file_handle = fioOpen(PathFilenameExtension, O_CREAT | O_WRONLY);
if (file_handle < 0)
DBGCOL_BLNK(4, 0x0000FF, true, IGS, "SaveTextFile(): FILEIO Open Error"); // Red
DBGCOL_BLNK(4, 0x0000FF, 1, IGS, "SaveTextFile(): FILEIO Open Error"); // Red

_strcpy(text, "PS2 IGS (InGame Screenshot)\n---------------------------\n");
_strcat(text, "\n\nGame ID=");
Expand Down Expand Up @@ -596,8 +596,8 @@ static u8 SaveBitmapFile(u16 width, u16 height, u8 pixel_size, void *buffer, u8

// Sequential numbering feature
while (1) {
if (Number == 255) // 255 screenshots per-game should be enough? lol
DBGCOL_BLNK(6, 0x0000FF, true, IGS, "SaveBitmapFile(): Number == 255"); // Red
if (Number == 255) // 255 screenshots per-game should be enough? lol
DBGCOL_BLNK(6, 0x0000FF, 1, IGS, "SaveBitmapFile(): Number == 255"); // Red
Number++;
_strcpy(PathFilenameExtension, "mc1:/");
_strcat(PathFilenameExtension, config->GameID);
Expand All @@ -617,13 +617,13 @@ static u8 SaveBitmapFile(u16 width, u16 height, u8 pixel_size, void *buffer, u8
// Create file
file_handle = fioOpen(PathFilenameExtension, O_CREAT | O_WRONLY);
if (file_handle < 0)
DBGCOL_BLNK(4, 0x0000FF, true, IGS, "SaveBitmapFile(): FILEIO error"); // Red
DBGCOL_BLNK(4, 0x0000FF, 1, IGS, "SaveBitmapFile(): FILEIO error"); // Red

// Write Bitmap Header
//(first, write the BMP Header ID ouside of struct, due to alignment issues...)
ret = fioWrite(file_handle, id, 2);
if (ret != 2)
DBGCOL_BLNK(5, 0x0000FF, true, IGS, "SaveBitmapFile(): FILEIO write err"); // Red
DBGCOL_BLNK(5, 0x0000FF, 1, IGS, "SaveBitmapFile(): FILEIO write err"); // Red
//(...then, write the remaining info!)
bh = (void *)((u8 *)buffer + image_size);
bh->filesize = (u32)file_size;
Expand All @@ -645,7 +645,7 @@ static u8 SaveBitmapFile(u16 width, u16 height, u8 pixel_size, void *buffer, u8

ret = fioWrite(file_handle, bh, 52);
if (ret != 52)
DBGCOL_BLNK(5, 0x0000FF, true, IGS, "SaveBitmapFile(): FILEIO write error"); // Red
DBGCOL_BLNK(5, 0x0000FF, 1, IGS, "SaveBitmapFile(): FILEIO write error"); // Red

// Write image in reverse order (since BMP is written Left to Right, Bottom to Top)
if (intffmd == 3) // Interlace Mode, FRAME Mode (Read every line)
Expand All @@ -658,11 +658,11 @@ static u8 SaveBitmapFile(u16 width, u16 height, u8 pixel_size, void *buffer, u8

ret = fioWrite(file_handle, addr, lenght);
if (ret != lenght)
DBGCOL_BLNK(5, 0x0000FF, true, IGS, "SaveBitmapFile(): FILEIO write error"); // Red
if (intffmd == 3) { // Interlace Mode, FRAME Mode (Read every line)
DBGCOL_BLNK(5, 0x0000FF, 1, IGS, "SaveBitmapFile(): FILEIO write error"); // Red
if (intffmd == 3) { // Interlace Mode, FRAME Mode (Read every line)
ret = fioWrite(file_handle, addr, lenght);
if (ret != lenght)
DBGCOL_BLNK(5, 0x0000FF, true, IGS, "SaveBitmapFile(): FILEIO write error"); // Red
DBGCOL_BLNK(5, 0x0000FF, 1, IGS, "SaveBitmapFile(): FILEIO write error"); // Red
}
BGCOLND((0xFFFFFF - (255 * i / height) * 0x010101)); // Gray Fade Out Effect
}
Expand Down Expand Up @@ -784,7 +784,7 @@ int InGameScreenshot(void)
FlushCache(0);
FlushCache(2);

DBGCOL_BLNK(1, 0xFF0000, false, IGS, "InGameScreenshot() end"); // Double Blue :-)
DBGCOL_BLNK(1, 0xFF0000, 0, IGS, "InGameScreenshot() end"); // Double Blue :-)

return 0;
}
2 changes: 1 addition & 1 deletion ee_core/src/modmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ int LoadOPLModule(int id, int mode, int arg_len, const char *args)
delay(3);
}
if (result == -400) {
DBGCOL_BLNK(1, 0x0000FF, true, MODMGR, "MODLOAD: out of IOP Memory"); // yellow blinking
DBGCOL_BLNK(1, 0x0000FF, 1, MODMGR, "MODLOAD: out of IOP Memory"); // yellow blinking
while (1)
;
}
Expand Down
2 changes: 1 addition & 1 deletion ee_core/src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ void BlinkColour(u8 x, u32 colour, u8 forever)
do {
delay(2);
BGCOLND(0x000000); // Black
//foo
// foo
for (i = 1; i <= x; i++) {
delay(1);
BGCOLND(colour); // Chosen colour
Expand Down
Loading

0 comments on commit 0df6959

Please sign in to comment.