minor code cleanup, corrections

This commit is contained in:
dborth 2008-10-11 08:06:36 +00:00
parent c78b4b8a3a
commit 835b0f2797
7 changed files with 32 additions and 72 deletions

View File

@ -125,7 +125,7 @@ PreferencesMenu ()
// they need to be skipped in the order they were enumerated in vba.h
// no USB ports on GameCube
#ifndef HW_RVL
#ifdef HW_DOL
if(GCSettings.LoadMethod == METHOD_USB)
GCSettings.LoadMethod++;
if(GCSettings.SaveMethod == METHOD_USB)
@ -136,8 +136,14 @@ PreferencesMenu ()
if(GCSettings.SaveMethod == METHOD_DVD)
GCSettings.SaveMethod++;
// disable DVD in GC mode (not implemented)
#ifdef HW_DOL
if(GCSettings.LoadMethod == METHOD_DVD)
GCSettings.LoadMethod++;
#endif
// disable SMB in GC mode (stalls out)
#ifndef HW_RVL
#ifdef HW_DOL
if(GCSettings.LoadMethod == METHOD_SMB)
GCSettings.LoadMethod++;
if(GCSettings.SaveMethod == METHOD_SMB)

View File

@ -246,6 +246,8 @@ Credits ()
DrawText (375, ypos, (char*)"emukidid");
DrawText (100, ypos += 18, (char*)"Original GameCube Port");
DrawText (375, ypos, (char*)"SoftDev");
DrawText (100, ypos += 18, (char*)"Visual Boy Advance - M");
DrawText (375, ypos, (char*)"VBA-M Team");
DrawText (100, ypos += 18, (char*)"Visual Boy Advance 1.7.2");
DrawText (375, ypos, (char*)"Forgotten");
DrawText (100, ypos += 18, (char*)"libogc");
@ -256,7 +258,7 @@ Credits ()
DrawText (-1, ypos += 36, (char*)"And many others who have contributed over the years!");
setfontsize (12);
DrawText (-1, ypos += 50, (char*)"This software is open source and may be copied,");
DrawText (-1, ypos += 40, (char*)"This software is open source and may be copied,");
DrawText (-1, ypos += 15, (char*)"distributed, or modified under the terms of");
DrawText (-1, ypos += 15, (char*)"the GNU General Public License (GPL) Version 2.");

View File

@ -141,7 +141,7 @@ preparePrefsData (int method)
createXMLSetting("LoadFolder", "Load Folder", GCSettings.LoadFolder);
createXMLSetting("SaveFolder", "Save Folder", GCSettings.SaveFolder);
//createXMLSetting("CheatFolder", "Cheats Folder", GCSettings.CheatFolder);
//createXMLSetting("VerifySaves", "Verify Memory Card Saves", toStr(GCSettings.VerifySaves));
createXMLSetting("VerifySaves", "Verify Memory Card Saves", toStr(GCSettings.VerifySaves));
createXMLSection("Network", "Network Settings");
@ -150,7 +150,10 @@ preparePrefsData (int method)
createXMLSetting("smbuser", "Share Username", GCSettings.smbuser);
createXMLSetting("smbpwd", "Share Password", GCSettings.smbpwd);
//createXMLSection("Emulation", "Emulation Settings");
createXMLSection("Emulation", "Emulation Settings");
createXMLSetting("NGCZoom", "Enable Zoom", toStr(GCSettings.NGCZoom));
createXMLSetting("render", "Video Rendering", toStr(GCSettings.render));
createXMLSection("Controller", "Controller Settings");
@ -273,6 +276,9 @@ decodePrefsData (int method)
// Emulation Settings
loadXMLSetting(&GCSettings.NGCZoom, "NGCZoom");
loadXMLSetting(&GCSettings.render, "render");
// Controller Settings
loadXMLController(gcpadmap, "gcpadmap");

View File

@ -532,7 +532,6 @@ u32 systemReadJoypad(int which)
****************************************************************************/
void systemDrawScreen()
{
// GB / GBC Have oodles of time - so sync on VSync
GX_Render( srcWidth, srcHeight, pix, srcPitch );
}
@ -678,7 +677,7 @@ bool LoadVBAROM(int method)
emulating = 1;
// reset frameskip variables
autoFrameSkipLastTime = frameskipadjust = systemFrameSkip = 0;
autoFrameSkipLastTime = systemFrameSkip = 0;
// Start system clock
mftb(&start);

View File

@ -260,9 +260,6 @@ void GX_Start()
GX_SetTevOp(GX_TEVSTAGE0, GX_DECAL);
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
//guOrtho(p, vmode->efbHeight/2, -(vmode->efbHeight/2), -(vmode->fbWidth/2), vmode->fbWidth/2, 10, 1000); // matrix, t, b, l, r, n, f
//GX_LoadProjectionMtx (p, GX_ORTHOGRAPHIC);
GX_CopyDisp (xfb[whichfb], GX_TRUE); // reset xfb
}
@ -353,7 +350,8 @@ ResetVideo_Emu ()
rmode = vmode; // same mode as menu
VIDEO_Configure (rmode);
VIDEO_ClearFrameBuffer (rmode, xfb[whichfb], COLOR_BLACK);
VIDEO_ClearFrameBuffer (rmode, xfb[0], COLOR_BLACK);
VIDEO_ClearFrameBuffer (rmode, xfb[1], COLOR_BLACK);
VIDEO_Flush();
VIDEO_WaitVSync();
if (rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync();
@ -369,9 +367,6 @@ ResetVideo_Emu ()
GX_SetFieldMode (rmode->field_rendering, ((rmode->viHeight == 2 * rmode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
GX_SetPixelFmt (GX_PF_RGB8_Z24, GX_ZC_LINEAR);
//guOrtho(p, rmode->efbHeight/2, -(rmode->efbHeight/2), -(rmode->fbWidth/2), rmode->fbWidth/2, 10, 1000); // matrix, t, b, l, r, n, f
//GX_LoadProjectionMtx (p, GX_ORTHOGRAPHIC);
}
/****************************************************************************
@ -401,9 +396,6 @@ ResetVideo_Menu ()
GX_SetFieldMode (vmode->field_rendering, ((vmode->viHeight == 2 * vmode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
GX_SetPixelFmt (GX_PF_RGB8_Z24, GX_ZC_LINEAR);
//guOrtho(p, vmode->efbHeight/2, -(vmode->efbHeight/2), -(vmode->fbWidth/2), vmode->fbWidth/2, 10, 1000); // matrix, t, b, l, r, n, f
//GX_LoadProjectionMtx (p, GX_ORTHOGRAPHIC);
}
void UpdateScaling()
@ -450,59 +442,16 @@ void GX_Render_Init(int width, int height, int haspect, int vaspect)
memset(texturemem, 0, texturesize);
/*** Setup for first call to scaler ***/
vwidth = vheight = oldvwidth = oldvheight = -1;
updateScaling = 1;
vwidth = width;
vheight = height;
oldvwidth = oldvheight = -1;
video_vaspect = vaspect;
video_haspect = haspect;
UpdateScaling();
}
/****************************************************************************
* MakeTexture
*
* Proper GNU Asm rendition of the above, converted by shagkur. - Thanks!
***************************************************************************/
void
MakeTexture (const void *src, void *dst, s32 width, s32 height)
{
register u32 tmp0 = 0, tmp1 = 0, tmp2 = 0, tmp3 = 0;
__asm__ __volatile__ (" srwi %6,%6,2\n"
" srwi %7,%7,2\n"
" subi %3,%4,4\n"
" mr %4,%3\n"
" subi %4,%4,4\n"
"2: mtctr %6\n"
" mr %0,%5\n"
//
"1: lwz %1,0(%5)\n"
" stwu %1,8(%4)\n"
" lwz %2,4(%5)\n"
" stwu %2,8(%3)\n"
" lwz %1,1024(%5)\n"
" stwu %1,8(%4)\n"
" lwz %2,1028(%5)\n"
" stwu %2,8(%3)\n"
" lwz %1,2048(%5)\n"
" stwu %1,8(%4)\n"
" lwz %2,2052(%5)\n"
" stwu %2,8(%3)\n"
" lwz %1,3072(%5)\n"
" stwu %1,8(%4)\n"
" lwz %2,3076(%5)\n"
" stwu %2,8(%3)\n"
" addi %5,%5,8\n"
" bdnz 1b\n"
" addi %5,%0,4096\n"
" subic. %7,%7,1\n"
" bne 2b"
// 0 1 2 3 4 5 6 7
:"=&r" (tmp0), "=&r" (tmp1), "=&r" (tmp2),
"=&r" (tmp3), "+r" (dst):"r" (src), "r" (width),
"r" (height));
}
/****************************************************************************
* GX_Render
*
@ -547,8 +496,6 @@ void GX_Render(int width, int height, u8 * buffer, int pitch)
updateScaling = 1;
}
//MakeTexture ((char *) buffer, (char *) texturemem, vwidth, vheight); // convert image to texture
for (h = 0; h < vheight; h += 4)
{
for (w = 0; w < (vwidth >> 2); w++)

View File

@ -151,8 +151,6 @@ u32 VMRead32( u32 address )
}
return READ32LE((rom + address));
}
/****************************************************************************
@ -237,7 +235,7 @@ static int vmpageno = 0;
static char *rombase = NULL;
static char *gbabase = NULL;
static FILE* romfile = NULL;
static int useVM = 0;
static int useVM = 1;
static u32 GBAROMSize = 0;
/**
@ -378,7 +376,7 @@ int VMCPULoadROM(int method)
VMInit();
VMAllocGBA();
loadtimeradjust = useVM = GBAROMSize = 0;
loadtimeradjust = GBAROMSize = 0;
switch (method)
{
@ -433,7 +431,6 @@ int VMCPULoadROM(int method)
vmpage[0].pageptr = rombase;
vmpage[0].pageno = 0;
vmpage[0].pagetype = MEM_VM;
useVM = 1;
CPUUpdateRenderBuffers( true );

View File

@ -72,8 +72,11 @@ u16 rtcRead(u32 address)
break;
}
}
//return READ16LE((&rom[address & 0x1FFFFFE]));
#ifdef USE_VM
return VMRead16( address & 0x1FFFFFE );
#else
return READ16LE((&rom[address & 0x1FFFFFE]));
#endif
}
static u8 toBCD(u8 value)