From 331e68678795fd4fc90db4541417ee115053c3ec Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Thu, 7 Jul 2011 03:43:27 +0000 Subject: [PATCH] Fixed OP scaling bug for sizes of 7.0 and up. --- src/gui/app.cpp | 10 ++++++++-- src/objectp.cpp | 26 ++++++++++++++++++-------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/gui/app.cpp b/src/gui/app.cpp index b313f66..c407149 100644 --- a/src/gui/app.cpp +++ b/src/gui/app.cpp @@ -31,11 +31,13 @@ int main(int argc, char * argv[]) { if (argc > 1) { - if (strcmp(argv[1], "--help") == 0) + if ((strcmp(argv[1], "--help") == 0) || (strcmp(argv[1], "-h") == 0) + || (strcmp(argv[1], "-?") == 0)) { printf("Virtual Jaguar 2.0.0 help\n"); printf("\n"); - printf("This is an experimental branch of Virtual Jaguar, how did you get it?\n"); + printf("Command line interface is non-functional ATM, but may return if there is\n" + "enough demand for it. :-)\n"); return 0; } } @@ -58,6 +60,10 @@ int main(int argc, char * argv[]) WriteLog("VJ: SDL (joystick, audio) successfully initialized.\n"); App app(argc, argv); // Declare an instance of the application retVal = app.exec(); // And run it! + + // Free SDL components last...! + SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_AUDIO); + SDL_Quit(); } LogDone(); // Close logfile diff --git a/src/objectp.cpp b/src/objectp.cpp index 5e2c985..de366ee 100644 --- a/src/objectp.cpp +++ b/src/objectp.cpp @@ -454,7 +454,7 @@ WriteLog(" --> List end\n\n"); ypos = TOMReadWord(0xF00046, OP) / 2; // Get the VDB value #endif // Actually, no. Any item less than VDB will get only the lines that hang over VDB displayed. -// So we need to fix this somehow... +// So we need to fix this somehow... (and it has... in tom.cpp :-P) uint32 height = (p0 & 0xFFC000) >> 14; uint32 oldOPP = op_pointer - 8; @@ -1175,10 +1175,10 @@ if (firstPix) // for use when using endian-corrected data (i.e., any of the *ReadWord functions!) uint16 * paletteRAM16 = (uint16 *)paletteRAM; - uint8 hscale = p2 & 0xFF; + uint16 hscale = p2 & 0xFF; // Hmm. It seems that fixing the horizontal scale necessitated re-fixing this. Not sure why, // but seems to be consistent with the vertical scaling now (and it may turn out to be wrong!)... - uint8 horizontalRemainder = hscale; // Not sure if it starts full, but seems reasonable [It's not!] + uint16 horizontalRemainder = hscale; // Not sure if it starts full, but seems reasonable [It's not!] // uint8 horizontalRemainder = 0; // Let's try zero! Seems to work! Yay! [No, it doesn't!] int32 scaledWidthInPixels = (iwidth * phraseWidthToPixels[depth] * hscale) >> 5; uint32 scaledPhrasePixels = (phraseWidthToPixels[depth] * hscale) >> 5; @@ -1392,6 +1392,11 @@ if (firstPix != 0) currentLineBuffer += lbufDelta; +/* +The reason we subtract the horizontalRemainder *after* the test is because we had too few +bytes for horizontalRemainder to properly recognize a negative number. But now it's 16 bits +wide, so we could probably go back to that (as long as we make it an int16 and not a uint16!) +*/ /* horizontalRemainder -= 0x20; // Subtract 1.0f in [3.5] fixed point format while (horizontalRemainder & 0x80) { @@ -1399,7 +1404,8 @@ if (firstPix != 0) pixCount++; pixels <<= 1; }//*/ - while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction) +// while (horizontalRemainder <= 0x20) // I.e., it's <= 1.0 (*before* subtraction) + while (horizontalRemainder < 0x20) // I.e., it's <= 1.0 (*before* subtraction) { horizontalRemainder += hscale; pixCount++; @@ -1458,7 +1464,8 @@ if (firstPix != 0) pixCount++; pixels <<= 2; }//*/ - while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction) +// while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction) + while (horizontalRemainder < 0x20) // I.e., it's <= 1.0 (*before* subtraction) { horizontalRemainder += hscale; pixCount++; @@ -1517,7 +1524,8 @@ if (firstPix != 0) pixCount++; pixels <<= 4; }//*/ - while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction) +// while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction) + while (horizontalRemainder < 0x20) // I.e., it's <= 0 (*before* subtraction) { horizontalRemainder += hscale; pixCount++; @@ -1572,7 +1580,8 @@ if (firstPix) currentLineBuffer += lbufDelta; - while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction) +// while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction) + while (horizontalRemainder < 0x20) // I.e., it's <= 1.0 (*before* subtraction) { horizontalRemainder += hscale; pixCount++; @@ -1629,7 +1638,8 @@ if (firstPix != 0) pixCount++; pixels <<= 16; }//*/ - while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction) +// while (horizontalRemainder <= 0x20) // I.e., it's <= 0 (*before* subtraction) + while (horizontalRemainder < 0x20) // I.e., it's <= 1.0 (*before* subtraction) { horizontalRemainder += hscale; pixCount++; -- 2.37.2