From 8968dd802c9877a66e1719453eac6c8699d9e97f Mon Sep 17 00:00:00 2001 From: dborth Date: Mon, 20 Oct 2008 07:30:59 +0000 Subject: [PATCH] correct audio channel reversal, fix Gamecube version --- Makefile.wii | 2 +- readme.txt | 14 +++++++++++--- source/ngc/audio.cpp | 5 +++-- source/ngc/video.cpp | 11 ----------- source/ngc/vmmem.cpp | 41 ++--------------------------------------- 5 files changed, 17 insertions(+), 56 deletions(-) diff --git a/Makefile.wii b/Makefile.wii index 8fa9b25..84a1b1c 100644 --- a/Makefile.wii +++ b/Makefile.wii @@ -26,7 +26,7 @@ INCLUDES := source/vba source/ngc #--------------------------------------------------------------------------------- CFLAGS = -g -O3 -Wall $(MACHDEP) $(INCLUDE) \ - -DNGC -DWII_DVD -DWORDS_BIGENDIAN -DVIDEO_THREADING \ + -DNGC -DWII_DVD -DWORDS_BIGENDIAN \ -DC_CORE -D__ppc__ -D__POWERPC__ -DFINAL_VERSION \ -DSDL -DNO_PNG -DHAVE_ZUTIL_H \ -D_SZ_ONE_DIRECTORY -D_LZMA_IN_CB -D_LZMA_OUT_READ diff --git a/readme.txt b/readme.txt index 1e0053f..89ae138 100644 --- a/readme.txt +++ b/readme.txt @@ -1,13 +1,13 @@ ¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤ - Visual Boy Advance GX - - Version 1.0.3 + Version 1.0.4 http://code.google.com/p/vba-wii (Under GPL License) ¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤°`°¤ø,¸,ø¤°`°¤ø,¸¸,ø¤ -Visual Boy Advance GX is a modified port of VBA-M / VBA 1.7.2. +Visual Boy Advance GX is a modified port of VBA-M. With it you can play GBA/Game Boy Color/Game Boy games on your Wii/GameCube. -=[ Features ]=- @@ -16,7 +16,7 @@ With it you can play GBA/Game Boy Color/Game Boy games on your Wii/GameCube. * SRAM and State saving * Custom controller configurations * SD, USB, DVD, SMB, GC Memory Card, Zip, and 7z support -* GBA compatiblity based on VBA-M r750, GB compatibility based on VBA 1.7.2 +* Compatiblity based on VBA-M r750 * MEM2 ROM Storage for fast access * Auto frame skip for those core heavy games * Turbo speed, video zooming, and unfiltered video options @@ -25,6 +25,14 @@ With it you can play GBA/Game Boy Color/Game Boy games on your Wii/GameCube. |0O×øo· UPDATE HISTORY ·oø×O0| `¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨' +[What's New 1.0.4] +* Sound processing improved - L-R channel reversal corrected, skipping fixed +* Complete port of VBA-M - now uses blaarg's new audio core, latest GB core +* Frameskipping improvements +* Save file problems fixed, game compatibility improved +* IPS/UPS patching support +* GameCube support is back! + [What's New 1.0.3 - October 15, 2008] * New timing / frameskip algorithm - should (hopefully) work 100% better! * Performance improvements - video threading, PPC core partly activated diff --git a/source/ngc/audio.cpp b/source/ngc/audio.cpp index c98216b..145ed36 100644 --- a/source/ngc/audio.cpp +++ b/source/ngc/audio.cpp @@ -20,6 +20,7 @@ static int tail = 0; #define MIXBUFFSIZE 0x10000 static u8 mixerdata[MIXBUFFSIZE]; #define MIXERMASK ((MIXBUFFSIZE >> 2) - 1) +#define SWAP(x) ((x>>16)|(x<<16)) // for reversing stereo channels static u8 soundbuffer[2][3840] ATTRIBUTE_ALIGN(32); extern int ConfigRequested; @@ -91,8 +92,8 @@ void MIXER_AddSamples( u8 *sampledata, int len ) do { - // Do simple linear interpolate - dst[head++] = src[fixofs >> 16]; + // Do simple linear interpolate, and swap channels from L-R to R-L + dst[head++] = SWAP(src[fixofs >> 16]); head &= MIXERMASK; fixofs += fixinc; } diff --git a/source/ngc/video.cpp b/source/ngc/video.cpp index adf1306..926abaf 100644 --- a/source/ngc/video.cpp +++ b/source/ngc/video.cpp @@ -81,7 +81,6 @@ static camera cam = { {0.0F, 0.0F, 0.0F}, {0.0F, 0.0F, -0.5F} }; -#ifdef VIDEO_THREADING /**************************************************************************** * VideoThreading ***************************************************************************/ @@ -126,8 +125,6 @@ InitVideoThread () LWP_CreateThread (&vbthread, vbgetback, NULL, vbstack, TSTACK, 80); } -#endif - /**************************************************************************** * copy_to_xfb * @@ -331,9 +328,7 @@ void InitialiseVideo () copynow = GX_FALSE; GX_Start(); - #ifdef VIDEO_THREADING InitVideoThread (); - #endif } /**************************************************************************** @@ -469,12 +464,8 @@ void GX_Render(int width, int height, u8 * buffer, int pitch) vwidth = width; vheight = height; - #ifdef VIDEO_THREADING // Ensure previous vb has complete while ((LWP_ThreadIsSuspended (vbthread) == 0) || (copynow == GX_TRUE)) - #else - while (copynow == GX_TRUE) - #endif { usleep (50); } @@ -532,10 +523,8 @@ void GX_Render(int width, int height, u8 * buffer, int pitch) VIDEO_Flush(); copynow = GX_TRUE; -#ifdef VIDEO_THREADING // Return to caller, don't waste time waiting for vb LWP_ResumeThread (vbthread); -#endif } /**************************************************************************** diff --git a/source/ngc/vmmem.cpp b/source/ngc/vmmem.cpp index 410c023..28c3edc 100644 --- a/source/ngc/vmmem.cpp +++ b/source/ngc/vmmem.cpp @@ -327,8 +327,6 @@ int VMCPULoadROM(int method) return 0; } - // printf("ROM Size %d\n", romfile->fsize); - res = fread(rom, 1, (1 << VMSHIFTBITS), romfile); if ( res != (1 << VMSHIFTBITS ) ) { @@ -368,9 +366,9 @@ static void VMNewPage( int pageid ) mftb(&start); res = fseek( romfile, pageid << VMSHIFTBITS, SEEK_SET ); - if ( ! res ) + if (res) // fseek returns non-zero on a failure { - sprintf(msg, "Seek error! - Offset %08x %d\n", pageid << VMSHIFTBITS, res); + sprintf(msg, "Seek error! - Offset %d / %08x %d\n", pageid, pageid << VMSHIFTBITS, res); WaitPrompt(msg); VMClose(); return; @@ -390,23 +388,6 @@ static void VMNewPage( int pageid ) mftb(&end); loadtimeradjust += tb_diff_msec(&end, &start); - -#if 0 - if ( pageid == 0x1FE ) - { - vmpage[pageid].pageptr[0x209C] = 0xDF; - vmpage[pageid].pageptr[0x209D] = 0xFA; - vmpage[pageid].pageptr[0x209E] = 0x47; - vmpage[pageid].pageptr[0x209F] = 0x70; - } - - printf("VMNP : %02x %04x %08x [%02x%02x%02x%02x] [%02x%02x%02x%02x]\n", vmpageno, pageid, - (u32)(vmpage[pageid].pageptr - rombase), vmpage[pageid].pageptr[0], vmpage[pageid].pageptr[1], - vmpage[pageid].pageptr[2], vmpage[pageid].pageptr[3], - vmpage[pageid].pageptr[0xfffc], vmpage[pageid].pageptr[0xfffd], - vmpage[pageid].pageptr[0xfffe], vmpage[pageid].pageptr[0xffff] ); -#endif - } /**************************************************************************** @@ -419,7 +400,6 @@ u32 VMRead32( u32 address ) int pageid; u32 badaddress; char msg[512]; - //printf("VM32 : Request %08x\n", address); if ( address >= GBAROMSize ) { @@ -443,10 +423,6 @@ u32 VMRead32( u32 address ) VMClose(); return 0; } - - /* Can never get here ... but stops gcc bitchin' */ - return 0; - } /**************************************************************************** @@ -458,8 +434,6 @@ u16 VMRead16( u32 address ) { int pageid; - //printf("VM16 : Request %08x\n", address); - if ( address >= GBAROMSize ) { return ( address >> 1 ) & 0xffff; @@ -480,10 +454,6 @@ u16 VMRead16( u32 address ) VMClose(); return 0; } - - /* Can never get here ... but stops gcc bitchin' */ - return 0; - } /**************************************************************************** @@ -495,8 +465,6 @@ u8 VMRead8( u32 address ) { int pageid; - //printf("VM8 : Request %08x\n", address); - if ( address >= GBAROMSize ) { return ( address >> 1 ) & 0xff; @@ -517,11 +485,6 @@ u8 VMRead8( u32 address ) VMClose(); return 0; } - - /* Can never get here ... but stops gcc bitchin' */ - return 0; - } #endif -