From a32368b84378ea412ca27d427365585bb9922429 Mon Sep 17 00:00:00 2001 From: infvaL <38145742+infval@users.noreply.github.com> Date: Tue, 24 Apr 2018 07:55:26 +0300 Subject: [PATCH] Add video mode DTV 640x480, fix Center Screen --- README.md | 2 +- src/drivers/ps2/browser.c | 43 ++++++++++-------- src/drivers/ps2/init.c | 84 ++++++++++++++-------------------- src/drivers/ps2/main.c | 19 +++++++- src/drivers/ps2/menu.c | 95 ++++++++++++++------------------------- src/drivers/ps2/ps2fceu.h | 4 +- src/drivers/ps2/ps2font.c | 67 +++++++++++++-------------- 7 files changed, 146 insertions(+), 168 deletions(-) diff --git a/README.md b/README.md index e38b7c1..9c4a257 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ D-pad: D-pad ## Dependencies * https://github.com/ps2dev/ps2sdk (use [ps2toolchain](https://github.com/ps2dev/ps2toolchain)) * https://github.com/ps2dev/gsKit -* https://github.com/ps2dev/ps2sdk-ports (libjpeg) +* https://github.com/ps2dev/ps2sdk-ports (libjpeg, libpng, libz) * https://github.com/ps2dev/ps2-packer (optinal) ## Historical note diff --git a/src/drivers/ps2/browser.c b/src/drivers/ps2/browser.c index 8d9155a..3619764 100644 --- a/src/drivers/ps2/browser.c +++ b/src/drivers/ps2/browser.c @@ -35,7 +35,6 @@ extern GSFONTM *gsFontM; extern u32 old_pad[4]; static struct padButtonStatus buttons[2]; -extern int defaultx, defaulty; int oldselect = -1; s8 selected = 0; u8 selected_dir = 0; @@ -44,9 +43,11 @@ extern int FONT_WIDTH; char path[4096] = "path"; int needed_path[2] = { -1, -1 }; char mpartitions[4][256]; -u16 history[20]; // 20 levels should be enough +static u16 history[20]; // 20 levels should be enough u8 h = 0; -int first_file_index; +static int first_file_index; + +#define FILEENTRY_SIZE 2048 extern int Browser_Menu(); @@ -244,7 +245,7 @@ int listdir(char *path, entries *FileEntry, int files_too) FileEntry[0].dircheck = 1; n = 1; while (fioDread(dd, &buf) > 0) { - if (n > 2046) { break; } + if (n > FILEENTRY_SIZE - 2) { break; } if ((FIO_SO_ISDIR(buf.stat.mode)) && (!strcmp(buf.name, ".") || !strcmp(buf.name, ".."))) continue; // Makes sure no .. or .'s are listed since it's already there if (FIO_SO_ISDIR(buf.stat.mode)) { @@ -252,7 +253,7 @@ int listdir(char *path, entries *FileEntry, int files_too) strcpy(FileEntry[n].filename, buf.name); strzncpy(FileEntry[n].displayname, FileEntry[n].filename, 63); n++; - if (n >= 2046) + if (n >= FILEENTRY_SIZE - 2) break; } } @@ -266,7 +267,7 @@ int listdir(char *path, entries *FileEntry, int files_too) dd = 0; dd = fioDopen(path); while (fioDread(dd, &buf) > 0) { - if (n > 2046) { break; } + if (n > FILEENTRY_SIZE - 2) { break; } if (FIO_SO_ISREG(buf.stat.mode)) { FileEntry[n].dircheck = 0; strcpy(FileEntry[n].filename, buf.name); @@ -337,7 +338,7 @@ int listpfs(char *path, entries *FileEntry, int files_too) n++; } - if (n > 2046) { break; } + if (n > FILEENTRY_SIZE - 2) { break; } } if (dd > 0) { fileXioDclose(dd); @@ -355,7 +356,7 @@ int listpfs(char *path, entries *FileEntry, int files_too) strzncpy(FileEntry[n].displayname, FileEntry[n].filename, 63); n++; } - if (n > 2046) { break; } + if (n > FILEENTRY_SIZE - 2) { break; } } if (dd >= 0) { fileXioDclose(dd); @@ -519,8 +520,8 @@ char* Browser(int files_too, int menu_id) int text_line = menu_y1 + 40; oldselect = -1; - //entries FileEntry[2048]; // = malloc(sizeof(entries)*2048); - entries *FileEntry = calloc(sizeof(entries), 2048); + //entries FileEntry[FILEENTRY_SIZE]; // = malloc(sizeof(entries)*FILEENTRY_SIZE); + entries *FileEntry = calloc(sizeof(entries), FILEENTRY_SIZE); int list_offset = text_line; @@ -559,15 +560,20 @@ char* Browser(int files_too, int menu_id) button_held = 0; } - if (Settings.display) { + if (Settings.display == 0) { + max_item = 21; + if (gsGlobal->Interlace == GS_NONINTERLACED) + max_item = 9; + } + else if (Settings.display == 1) { max_item = 25; + if (gsGlobal->Interlace == GS_NONINTERLACED) + max_item = 9; } - else { - max_item = 21; + else if (Settings.display == 2) { + max_item = 23; } - if (gsGlobal->Interlace == GS_NONINTERLACED) - max_item = 9; - + // Scan for direct commands from input function if (oldselect == -4) { // Just pushed triangle so go up a dir @@ -600,7 +606,7 @@ char* Browser(int files_too, int menu_id) // List files below if (strcmp(path, oldpath) != 0) { - first_file_index = 2048; + first_file_index = FILEENTRY_SIZE; if (!strncmp(path, "hdd0:/", 6)) { if (!strcmp(path, "hdd0:/")) { // hdd0: selected so list partitions n = listpartitions(FileEntry); @@ -639,7 +645,7 @@ char* Browser(int files_too, int menu_id) if (selection != oldselect) { gsKit_clear(gsGlobal, GS_SETREG_RGBAQ(0x00, 0x00, 0x00, 0x80, 0x00)); - browser_primitive("FCEUltra PS2 B0.93 [x.3.1]", "Browser", &BG_TEX, menu_x1, menu_y1, menu_x2, menu_y2); + browser_primitive("FCEUltra PS2 B0.93 [x.3.2]", "Browser", &BG_TEX, menu_x1, menu_y1, menu_x2, menu_y2); if (selection > max_item) { list_offset = text_line - (selection - max_item) * FONT_HEIGHT; @@ -730,6 +736,7 @@ char* Browser(int files_too, int menu_id) } } else if (!FileEntry[selection].dircheck) { // If file + first_file_index = FILEENTRY_SIZE; sprintf(path, "%s%s", path, FileEntry[selection].filename); printf("rompath = %s\n", path); history[h] = selection; diff --git a/src/drivers/ps2/init.c b/src/drivers/ps2/init.c index 1f12d24..d0fb2ef 100644 --- a/src/drivers/ps2/init.c +++ b/src/drivers/ps2/init.c @@ -26,8 +26,6 @@ #include "ps2fceu.h" extern vars Settings; -int defaultx; -int defaulty; // Input #define NEW_PADMAN @@ -72,6 +70,8 @@ extern unsigned int size_cdvd_irx; extern unsigned char SMSUTILS_irx; extern unsigned int size_SMSUTILS_irx; +static int VCK; + void poweroffps2(int i) { poweroffShutdown(); @@ -80,18 +80,10 @@ void poweroffps2(int i) void SetupGSKit() { /* detect and set screentype */ - //gsGlobal = gsKit_init_global(GS_MODE_PAL); - //gsGlobal = gsKit_init_global_custom(GS_RENDER_QUEUE_OS_POOLSIZE+GS_RENDER_QUEUE_OS_POOLSIZE/2, GS_RENDER_QUEUE_PER_POOLSIZE+GS_RENDER_QUEUE_PER_POOLSIZE/2); if (gsGlobal != NULL) gsKit_deinit_global(gsGlobal); gsGlobal = gsKit_init_global(); - //gsGlobal->Height = 512; // No need for it - - defaultx = gsGlobal->StartX; - defaulty = gsGlobal->StartY; - /* initialize dmaKit */ - //dmaKit_init(D_CTRL_RELE_OFF, D_CTRL_MFD_OFF, D_CTRL_STS_UNSPEC, D_CTRL_STD_OFF, D_CTRL_RCYC_8); dmaKit_init(D_CTRL_RELE_OFF, D_CTRL_MFD_OFF, D_CTRL_STS_UNSPEC, D_CTRL_STD_OFF, D_CTRL_RCYC_8, 1 << DMA_CHANNEL_GIF); dmaKit_chan_init(DMA_CHANNEL_GIF); @@ -103,8 +95,6 @@ void SetupGSKit() // 640x448, ntsc, tv // 640x512, pal, tv - //gsGlobal->Width = 640; // No need for it - } void InitPS2() @@ -174,56 +164,50 @@ printf("Failed to load module: cdInit2\n"); mtapPortOpen(0); } -void normalize_screen() -{ - GS_SET_DISPLAY1(gsGlobal->StartX, // X position in the display area (in VCK unit - gsGlobal->StartY, // Y position in the display area (in Raster u - gsGlobal->MagH, // Horizontal Magnification - gsGlobal->MagV, // Vertical Magnification - gsGlobal->DW - 1, // Display area width - gsGlobal->DH - 1); // Display area height - - GS_SET_DISPLAY2(gsGlobal->StartX, // X position in the display area (in VCK units) - gsGlobal->StartY, // Y position in the display area (in Raster units) - gsGlobal->MagH, // Horizontal Magnification - gsGlobal->MagV, // Vertical Magnification - gsGlobal->DW - 1, // Display area width - gsGlobal->DH - 1); // Display area height -} - void init_custom_screen() { - // Init real non-interlaced mode - if (Settings.display) { + if (Settings.display == 0) { + gsGlobal->Mode = GS_MODE_NTSC; + gsGlobal->Interlace = GS_INTERLACED; + gsGlobal->Field = GS_FIELD; + gsGlobal->Width = 640; + gsGlobal->Height = 448; + VCK = 4; + } + else if (Settings.display == 1) { gsGlobal->Mode = GS_MODE_PAL; + gsGlobal->Interlace = GS_INTERLACED; + gsGlobal->Field = GS_FIELD; + gsGlobal->Width = 640; gsGlobal->Height = 512; - defaulty = 72; + VCK = 4; } - else { - gsGlobal->Mode = GS_MODE_NTSC; - gsGlobal->Height = 448; - defaulty = 50; + else if (Settings.display == 2) { + gsGlobal->Mode = GS_MODE_DTV_480P; + gsGlobal->Interlace = GS_NONINTERLACED; + gsGlobal->Field = GS_FRAME; + gsGlobal->Width = 640; + gsGlobal->Height = 480; + VCK = 2; } - gsGlobal->Field = GS_FIELD; - gsGlobal->Width = 640; - - gsGlobal->StartX = defaultx + Settings.offset_x; - gsGlobal->StartY = defaulty + Settings.offset_y; - if (!Settings.interlace) { - gsGlobal->Interlace = GS_NONINTERLACED; - gsGlobal->Height = gsGlobal->Height / 2; - gsGlobal->StartY = gsGlobal->StartY / 2 + 1; + if (Settings.display == 0 || Settings.display == 1) { + if (!Settings.interlace) { + gsGlobal->Interlace = GS_NONINTERLACED; + gsGlobal->Height = gsGlobal->Height / 2; + VCK = 2; + } } - //else if (gsGlobal->Mode == GS_MODE_NTSC) - //gsGlobal->StartY = gsGlobal->StartY + 22; -// SetGsCrt(gsGlobal->Interlace, gsGlobal->Mode, gsGlobal->Field); + gsKit_vram_clear(gsGlobal); gsKit_init_screen(gsGlobal); /* Apply settings. */ + gsKit_set_display_offset(gsGlobal, Settings.offset_x * VCK, Settings.offset_y); gsKit_mode_switch(gsGlobal, GS_ONESHOT); +} -// normalize_screen(); - +void SetDisplayOffset() +{ + gsKit_set_display_offset(gsGlobal, Settings.offset_x * VCK, Settings.offset_y); } void DrawScreen(GSGLOBAL *gsGlobal) diff --git a/src/drivers/ps2/main.c b/src/drivers/ps2/main.c index 3d33f5b..7d17413 100644 --- a/src/drivers/ps2/main.c +++ b/src/drivers/ps2/main.c @@ -887,12 +887,27 @@ void SetupNESGS() width = newWidth; } } - else { + else if (gsGlobal->Mode == GS_MODE_PAL) { v1 = 0; v2 = NES_TEX.Height; y2 = NES_TEX.Height; + + if (Settings.aspect_ratio == 1) { + offsetX = 80; + width = 480; + } + } + else if (gsGlobal->Mode == GS_MODE_DTV_480P) { + v1 = 0; + v2 = NES_TEX.Height; + y2 = gsGlobal->Height; + + if (Settings.aspect_ratio == 1) { + offsetX = 64; + width = 512; + } } - if (gsGlobal->Interlace == GS_INTERLACED) + if (gsGlobal->Interlace == GS_INTERLACED && (gsGlobal->Mode == GS_MODE_NTSC || gsGlobal->Mode == GS_MODE_PAL)) y2 = y2*2; //gsKit_prim_sprite_striped_texture(gsGlobal, &NES_TEX, // Thought this might be needed for different modes, but it just looks bad diff --git a/src/drivers/ps2/menu.c b/src/drivers/ps2/menu.c index d49a85f..320a5d0 100644 --- a/src/drivers/ps2/menu.c +++ b/src/drivers/ps2/menu.c @@ -18,8 +18,6 @@ // Settings extern vars Settings; -extern int defaultx; -extern int defaulty; // Skin extern skin FCEUSkin; extern u8 menutex; @@ -207,11 +205,9 @@ int menu_input(int port, int center_screen) selected = 2; } } + // FIXME: Screen always updates if ((center_screen && change) || (center_screen == 2)) { - gsGlobal->StartX = defaultx + Settings.offset_x; - gsGlobal->StartY = defaulty + Settings.offset_y; - - normalize_screen(); + SetDisplayOffset(); gsKit_clear(gsGlobal, GS_SETREG_RGBAQ(0x00, 0x00, 0x00, 0x00, 0x00)); @@ -268,12 +264,15 @@ int Browser_Menu() for (i = 0; i < 12; i++) { switch (i) { case 0: - if (!Settings.display) { + if (Settings.display == 0) { strcpy(options_state[i], "NTSC"); } - else { + else if (Settings.display == 1) { strcpy(options_state[i], "PAL"); } + else if (Settings.display == 2) { + strcpy(options_state[i], "DTV 640x480"); + } break; case 1: if (Settings.interlace) { @@ -358,74 +357,46 @@ int Browser_Menu() i = selection; switch (i) { case 0: // Display PAL/NTSC - Settings.display ^= 1; - if (Settings.display) { - gsGlobal->Mode = GS_MODE_PAL; - gsGlobal->Height = 512; - defaulty = 72; - strcpy(options_state[i], "PAL"); + Settings.display++; + if (Settings.display >= 3) { + Settings.display = 0; } - else { - gsGlobal->Mode = GS_MODE_NTSC; - gsGlobal->Height = 448; - defaulty = 50; + if (Settings.display == 0) { strcpy(options_state[i], "NTSC"); } - gsGlobal->Width = 640; - gsGlobal->Field = GS_FIELD; - if (gsGlobal->Interlace == GS_NONINTERLACED) { - gsGlobal->Height = gsGlobal->Height/2; - gsGlobal->StartY = gsGlobal->StartY/2 -1 ; + else if (Settings.display == 1) { + strcpy(options_state[i], "PAL"); + } + else if (Settings.display == 2) { + strcpy(options_state[i], "DTV 640x480"); } - gsGlobal->StartY = gsGlobal->StartY + Settings.offset_y; - //if (Settings.interlace && (gsGlobal->Mode == GS_MODE_NTSC)) - //gsGlobal->StartY = gsGlobal->StartY + 22; - //else - //gsGlobal->StartY = gsGlobal->StartY + 11; - //normalize_screen(); - gsKit_init_screen(gsGlobal); /* Apply settings. */ - gsKit_mode_switch(gsGlobal, GS_ONESHOT); - - menu_x1 = gsGlobal->Width*0.25; - menu_y1 = gsGlobal->Height*0.15; - menu_x2 = gsGlobal->Width*0.75; - menu_y2 = gsGlobal->Height*0.85 + FONT_HEIGHT; - text_line = menu_y1 + 4; + init_custom_screen(); + menu_x1 = gsGlobal->Width * 0.25; + menu_y1 = gsGlobal->Height * 0.15; + menu_x2 = gsGlobal->Width * 0.75; + menu_y2 = gsGlobal->Height * 0.85 + FONT_HEIGHT; + text_line = menu_y1 + 4; option_changed = 1; - //SetGsCrt(gsGlobal->Interlace, gsGlobal->Mode, gsGlobal->Field); break; case 1: // Interlacing Off/On Settings.interlace ^= 1; - if (gsGlobal->Mode == GS_MODE_PAL) - gsGlobal->Height = 512; - else - gsGlobal->Height = 448; if (Settings.interlace) { - gsGlobal->Interlace = GS_INTERLACED; - //gsGlobal->StartY = (gsGlobal->StartY-1)*2; strcpy(options_state[i], "On"); } else { - gsGlobal->Interlace = GS_NONINTERLACED; - gsGlobal->StartY = gsGlobal->StartY/2 + 1; - gsGlobal->Height = gsGlobal->Height/2; strcpy(options_state[i], "Off"); } - gsGlobal->Width = 640; - gsGlobal->Field = GS_FIELD; - //normalize_screen(); - gsKit_init_screen(gsGlobal); /* Apply settings. */ - gsKit_mode_switch(gsGlobal, GS_ONESHOT); - - menu_x1 = gsGlobal->Width*0.25; - menu_y1 = gsGlobal->Height*0.15; - menu_x2 = gsGlobal->Width*0.75; - menu_y2 = gsGlobal->Height*0.85 + FONT_HEIGHT; + + init_custom_screen(); + + menu_x1 = gsGlobal->Width * 0.25; + menu_y1 = gsGlobal->Height * 0.15; + menu_x2 = gsGlobal->Width * 0.75; + menu_y2 = gsGlobal->Height * 0.85 + FONT_HEIGHT; text_line = menu_y1 + 4; option_changed = 1; - //SetGsCrt(gsGlobal->Interlace, gsGlobal->Mode, gsGlobal->Field); break; case 2: // Emulated System Settings.emulation ^= 1; @@ -482,7 +453,7 @@ int Browser_Menu() break; case 9: // Power Off poweroffShutdown(); - if (Settings.display) + if (Settings.display == 1) power_off = 50/4; else power_off = 60/4; @@ -565,7 +536,7 @@ void Ingame_Menu() if (Settings.aspect_ratio == 0) strcpy(options_state[i], "Full Screen"); else if (Settings.aspect_ratio == 1) - strcpy(options_state[i], "Best Fit (4:3 NTSC)"); + strcpy(options_state[i], "Best Fit (4:3)"); break; case 5: if (!Settings.sound) @@ -664,13 +635,13 @@ void Ingame_Menu() break; case 4: Settings.aspect_ratio++; - if (Settings.aspect_ratio > 1) { + if (Settings.aspect_ratio >= 2) { Settings.aspect_ratio = 0; } if (Settings.aspect_ratio == 0) strcpy(options_state[i], "Full Screen"); else if (Settings.aspect_ratio == 1) - strcpy(options_state[i], "Best Fit (4:3 NTSC)"); + strcpy(options_state[i], "Best Fit (4:3)"); option_changed = 1; break; case 5: diff --git a/src/drivers/ps2/ps2fceu.h b/src/drivers/ps2/ps2fceu.h index a42c989..8d9f96e 100644 --- a/src/drivers/ps2/ps2fceu.h +++ b/src/drivers/ps2/ps2fceu.h @@ -12,7 +12,7 @@ typedef struct { typedef struct { int offset_x; int offset_y; - u8 display; + int display; u8 emulation; u8 interlace; u8 filter; @@ -42,10 +42,10 @@ typedef struct { // Initialization prototypes void SetupGSKit(); void InitPS2(); -void normalize_screen(); void init_custom_screen(); void setupPS2Pad(); +void SetDisplayOffset(); void DrawScreen(GSGLOBAL *gsGlobal); // Text related prototypes diff --git a/src/drivers/ps2/ps2font.c b/src/drivers/ps2/ps2font.c index 0887eaf..3fccadb 100644 --- a/src/drivers/ps2/ps2font.c +++ b/src/drivers/ps2/ps2font.c @@ -8,30 +8,30 @@ extern vars Settings; extern GSGLOBAL *gsGlobal; -u8 *FontBuffer; +u8 *FontBuffer; extern unsigned char font_uLE[]; enum { - //0x100-0x109 are 5 double width characters for D-Pad buttons, which are accessed as: - //"�0"==Circle "�1"==Cross "�2"==Square "�3"==Triangle "�4"==filled Square - RIGHT_CUR = 0x10A, //Triangle pointing left, for use to the right of an item - LEFT_CUR = 0x10B, //Triangle pointing right, for use to the left of an item - UP_ARROW = 0x10C, //Arrow pointing up - DN_ARROW = 0x10D, //Arrow pointing up - LT_ARROW = 0x10E, //Arrow pointing up - RT_ARROW = 0x10F, //Arrow pointing up - TEXT_CUR = 0x110, //Vertical bar, for use between two text characters - UL_ARROW = 0x111, //Arrow pointing up and to the left, from a vertical start. - BR_SPLIT = 0x112, //Splits rectangle from BL to TR with BR portion filled - BL_SPLIT = 0x113, //Splits rectangle from TL to BR with BL portion filled - //0x114-0x11B are 4 double width characters for D-Pad buttons, which are accessed as: - //"�:"==Right "�;"==Down "�<"==Left "�="==Up - //0x11C-0x123 are 4 doubled characters used as normal/marked folder/file icons + // 0x100-0x109 are 5 double width characters for D-Pad buttons, which are accessed as: + // "�0"==Circle "�1"==Cross "�2"==Square "�3"==Triangle "�4"==filled Square + RIGHT_CUR = 0x10A, // Triangle pointing left, for use to the right of an item + LEFT_CUR = 0x10B, // Triangle pointing right, for use to the left of an item + UP_ARROW = 0x10C, // Arrow pointing up + DN_ARROW = 0x10D, // Arrow pointing up + LT_ARROW = 0x10E, // Arrow pointing up + RT_ARROW = 0x10F, // Arrow pointing up + TEXT_CUR = 0x110, // Vertical bar, for use between two text characters + UL_ARROW = 0x111, // Arrow pointing up and to the left, from a vertical start. + BR_SPLIT = 0x112, // Splits rectangle from BL to TR with BR portion filled + BL_SPLIT = 0x113, // Splits rectangle from TL to BR with BL portion filled + // 0x114-0x11B are 4 double width characters for D-Pad buttons, which are accessed as: + // "�:"==Right "�;"==Down "�<"==Left "�="==Up + // 0x11C-0x123 are 4 doubled characters used as normal/marked folder/file icons ICON_FOLDER = 0x11C, ICON_M_FOLDER = 0x11E, ICON_FILE = 0x120, ICON_M_FILE = 0x122, - FONT_COUNT = 0x124 //Total number of characters in font + FONT_COUNT = 0x124 // Total number of characters in font }; /*GSTEXTURE FONT_TEX; @@ -190,7 +190,7 @@ int loadFont(char *path_arg) } // end else bad fnt file }else{ // end if external font file*/ //use_default: - if(FontBuffer) + if (FontBuffer) free(FontBuffer); FontBuffer = malloc(4096 + 1); memcpy(FontBuffer, &font_uLE, 4096); @@ -203,32 +203,33 @@ void drawChar(unsigned int c, int x, int y, int z, u64 colour) int i, j, pixBase, pixMask; u8 *cm; - if (!Settings.interlace) { + if (gsGlobal->Interlace == GS_NONINTERLACED) { y = y & -2; } if (c >= FONT_COUNT) c = '_'; - if (c > 0xFF) //if char is beyond normal ascii range - cm = &font_uLE[c * 16]; // cm points to special char def in default font - else //else char is inside normal ascii range - cm = &FontBuffer[c * 16]; // cm points to normal char def in active font + if (c > 0xFF) // If char is beyond normal ascii range + cm = &font_uLE[c * 16]; // cm points to special char def in default font + else // Else char is inside normal ascii range + cm = &FontBuffer[c * 16]; // cm points to normal char def in active font pixMask = 0x80; - for (i = 0; i < 8; i++) { //for i == each pixel column + for (i = 0; i < 8; i++) { // For i == each pixel column pixBase = -1; - for (j = 0; j < 16; j++) { //for j == each pixel row - if ((pixBase < 0) && (cm[j] & pixMask)) { //if start of sequence + for (j = 0; j < 16; j++) { // For j == each pixel row + if ((pixBase < 0) && (cm[j] & pixMask)) { // If start of sequence pixBase = j; - } else if ((pixBase > -1) && !(cm[j] & pixMask)) { //if end of sequence + } + else if ((pixBase > -1) && !(cm[j] & pixMask)) { // If end of sequence gsKit_prim_sprite(gsGlobal, x + i, y + pixBase - 1, x + i + 1, y + j - 1, z, colour); pixBase = -1; } - } //ends for j == each pixel row - if (pixBase > -1) //if end of sequence including final row + } // Ends for j == each pixel row + if (pixBase > -1) // If end of sequence including final row gsKit_prim_sprite(gsGlobal, x + i, y + pixBase - 1, x + i + 1, y + j - 1, z, colour); pixMask >>= 1; - } //ends for i == each pixel column + } // Ends for i == each pixel column } #define SCREEN_MARGIN 6 @@ -267,8 +268,8 @@ int printXY(const char *s, int x, int y, int z, u64 colour, int draw, int space) continue; c1 = (c2 - '0') * 2 + 0x100; if (draw) { - //expand sequence �0=Circle �1=Cross �2=Square �3=Triangle �4=FilledBox - //"�:"=Pad_Right "�;"=Pad_Down "�<"=Pad_Left "�="=Pad_Up + // Expand sequence �0=Circle �1=Cross �2=Square �3=Triangle �4=FilledBox + // "�:"=Pad_Right "�;"=Pad_Down "�<"=Pad_Left "�="=Pad_Up drawChar(c1, x, y, z, colour); x += 8; if (x > gsGlobal->Width - SCREEN_MARGIN - FONT_WIDTH) @@ -278,6 +279,6 @@ int printXY(const char *s, int x, int y, int z, u64 colour, int draw, int space) if (x > gsGlobal->Width - SCREEN_MARGIN - FONT_WIDTH) break; } - } // ends while(1) + } // Ends while(1) return x; }