win32: fix map view tool to display more modes, taking advantage of more evolved gpu code. also port changelog from 094 branch

This commit is contained in:
zeromus 2009-07-06 05:54:02 +00:00
parent 6e05ab43a1
commit 2a9f14b516
4 changed files with 102 additions and 156 deletions

View File

@ -1,4 +1,28 @@
0.9.2 -> 0.9.3
0.9.4 -> ??? (r2437-r???)
Highlights:
* win32: lua engine, path configuration, 7z dearchiving support
General/Core:
bug: fix cflash directory support for non-windows
bug: fix freeze in cart irq
bug: correctly emulate dma to/from tcm
enh: ideas-style debugging prints
Graphics:
bug: fixing of obj blending and bmp obj rendering
bug: swrast: add clear image emulation
bug: swrast: add edge marking
Windows:
bug: improve map view tool
0.9.2 -> 0.9.4 (r1844->r2352->r2437)
0.9.3 was skipped due to emu news sites sneaking it out of our staging area and
releasing it prematurely while it still had bugs. I was going to curse them
individually, but then I decided that they would just like the publicity.
Highlights:
* New save autodetection and save file format
* Full rerecording support
@ -10,10 +34,12 @@ General/Core:
bug: fix in ipc sync which broke devkitpro touch
bug: screenshots now exclude hud and rotation
bug: rewritten vram mapping (fixes corrupted or missing BG)
enh: add universal commandline system (same commandline options on every port)
enh: cheats: added Action Replay code parser
enh: more reliable and useful frameskipping
enh: SPU: speedup: add adpcm caching
enh: SPU: speedup: interpolation is now optional
enh: print svn build number so we can identify people's svn builds from screenshots
Graphics:
bug: add polygon y-sorting (fixes 3d guis)
@ -21,9 +47,13 @@ Graphics:
bug: display capture fixes
bug: fix a number of OBJ modes
bug: fixes to affine BG modes
bug: better emulate some translucent OBJ
bug: more correct handling of color effect windows and backdrop colors
bug: fix matrix stack overrun which crashed emulator
enh: add alternate flush mode, fixes some entirely broken 3d games
bug: swrast: add clear depth image emulation and other fixes to depth buffering
bug: swrast: fix some toon and highlight cases
bug: fix bug in matrix stack, fixes some broken models
enh: add alternate flush mode HACK 3d config toggle, fixes some entirely broken 3d games
Windows:
bug: more robust cheats engine and dialog
@ -32,6 +62,9 @@ Windows:
enh: added tools: spu viewer, ram watch, ram search
enh: change build configuration system
enh: speedup: add gpu core disabling to hide useless screens
enh: add background pause feature (for when emulator loses focus)
enh: add missing autohold for L and R
enh: add chinese translation
Gtk frontend:
enh: switch all of menu/toolbar system to GtkAction + GtkUIManager
@ -42,6 +75,7 @@ Gtk frontend:
Cli frontend:
enh: hooked the frameskip (szigor)
enh: misc usability improvements: auto pause switch for pausing when focus is lost and exit on escape pressing (szigor)
enh: hook the fake noise mic; use m to toggle
0.9.1 -> 0.9.2
General/Core:

View File

@ -22,24 +22,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// CONTENTS
// INITIALIZATION
// ENABLING / DISABLING LAYERS
// PARAMETERS OF BACKGROUNDS
// PARAMETERS OF ROTOSCALE
// PARAMETERS OF EFFECTS
// PARAMETERS OF WINDOWS
// ROUTINES FOR INSIDE / OUTSIDE WINDOW CHECKS
// PIXEL RENDERING
// BACKGROUND RENDERING -TEXT-
// BACKGROUND RENDERING -ROTOSCALE-
// BACKGROUND RENDERING -HELPER FUNCTIONS-
// SPRITE RENDERING -HELPER FUNCTIONS-
// SPRITE RENDERING
// SCREEN FUNCTIONS
// GRAPHICS CORE
// GPU_ligne
#include <algorithm>
#include <string.h>
#include <stdlib.h>
@ -89,7 +71,7 @@ const size sprSizeTab[4][4] =
static const BGType mode2type[8][4] =
const BGType GPU_mode2type[8][4] =
{
{BGType_Text, BGType_Text, BGType_Text, BGType_Text},
{BGType_Text, BGType_Text, BGType_Text, BGType_Affine},
@ -860,7 +842,7 @@ void GPU_setBGProp(GPU * gpu, u16 num, u16 p)
break;
}
BGType mode = mode2type[dispCnt->BG_Mode][num];
BGType mode = GPU_mode2type[dispCnt->BG_Mode][num];
//clarify affine ext modes
if(mode == BGType_AffineExt)
@ -1608,16 +1590,21 @@ template<bool MOSAIC> void lineRot(GPU * gpu)
} else {
parms = &(gpu->dispx_st)->dispx_BG3PARMS;
}
rotBG2<MOSAIC>(gpu,
parms->BGxX,
parms->BGxY,
parms->BGxPA,
parms->BGxPB,
parms->BGxPC,
parms->BGxPD,
256);
parms->BGxX += parms->BGxPB;
parms->BGxY += parms->BGxPD;
if(gpu->debug)
rotBG2<MOSAIC>(gpu, 0, (s16)gpu->currLine*256, 256,0, -1,-1, 256);
else
{
rotBG2<MOSAIC>(gpu,
parms->BGxX,
parms->BGxY,
parms->BGxPA,
parms->BGxPB,
parms->BGxPC,
parms->BGxPD,
256);
parms->BGxX += parms->BGxPB;
parms->BGxY += parms->BGxPD;
}
}
template<bool MOSAIC> void lineExtRot(GPU * gpu)
@ -1628,7 +1615,12 @@ template<bool MOSAIC> void lineExtRot(GPU * gpu)
} else {
parms = &(gpu->dispx_st)->dispx_BG3PARMS;
}
extRotBG2<MOSAIC>(gpu,
if(gpu->debug)
extRotBG2<MOSAIC>(gpu, 0, (s16)gpu->currLine*256, 256,0, -1,-1, 256);
else
{
extRotBG2<MOSAIC>(gpu,
parms->BGxX,
parms->BGxY,
parms->BGxPA,
@ -1636,41 +1628,8 @@ template<bool MOSAIC> void lineExtRot(GPU * gpu)
parms->BGxPC,
parms->BGxPD,
256);
parms->BGxX += parms->BGxPB;
parms->BGxY += parms->BGxPD;
}
namespace GPU_EXT {
void textBG(GPU * gpu, u8 num, u8 * DST)
{
gpu->currBgNum = num;
for(u32 i = 0; i < gpu->BGSize[num][1]; ++i)
{
gpu->currDst = DST + i*gpu->BGSize[num][0]*2;
gpu->currLine = i;
renderline_textBG<false>(gpu, 0, i, gpu->BGSize[num][0]);
}
}
void rotBG(GPU * gpu, u8 num, u8 * DST)
{
gpu->currBgNum = num;
for(u32 i = 0; i < gpu->BGSize[num][1]; ++i)
{
gpu->currDst = DST + i*gpu->BGSize[num][0]*2;
gpu->currLine = i;
rotBG2<false>(gpu, 0, 0, 256, 0, 0, 256, gpu->BGSize[num][0]);
}
}
void extRotBG(GPU * gpu, u8 num, u8 * DST)
{
for(u32 i = 0; i < gpu->BGSize[num][1]; ++i)
{
gpu->currDst = DST + i*gpu->BGSize[num][0]*2;
gpu->currLine = i;
extRotBG2<false>(gpu, 0, 0, 256, 0, 0, 256, gpu->BGSize[num][0]);
}
parms->BGxX += parms->BGxPB;
parms->BGxY += parms->BGxPD;
}
}
@ -3051,7 +3010,7 @@ void GPU::refreshAffineStartRegs(const int num, const int xy)
template<bool MOSAIC> void GPU::modeRender(int layer)
{
switch(mode2type[dispCnt().BG_Mode][layer])
switch(GPU_mode2type[dispCnt().BG_Mode][layer])
{
case BGType_Text: lineText<MOSAIC>(this); break;
case BGType_Affine: lineRot<MOSAIC>(this); break;

View File

@ -622,12 +622,21 @@ enum BGType {
BGType_AffineExt=4, BGType_AffineExt_256x16=5, BGType_AffineExt_256x1=6, BGType_AffineExt_Direct=7
};
extern const BGType GPU_mode2type[8][4];
struct GPU
{
GPU()
: debug(false)
{}
// some structs are becoming redundant
// some functions too (no need to recopy some vars as it is done by MMU)
REG_DISPx * dispx_st;
//this indicates whether this gpu is handling debug tools
bool debug;
_BGxCNT & bgcnt(int num) { return (dispx_st)->dispx_BGxCNT[num].bits; }
_DISPCNT & dispCnt() { return dispx_st->dispx_DISPCNT.bits; }
template<bool MOSAIC> void modeRender(int layer);

View File

@ -30,7 +30,7 @@
using namespace GPU_EXT;
typedef struct
struct mapview_struct
{
u32 autoup_secs;
bool autoup;
@ -38,10 +38,36 @@ typedef struct
u16 map;
u16 lcd;
u16 bitmap[1024*1024];
} mapview_struct;
void render()
{
//we're going to make a copy of the gpu so that we don't wreck affine scroll params
//hopefully we won't mess up anything else
GPU *realGpu;
if(lcd) realGpu = SubScreen.gpu;
else realGpu = MainScreen.gpu;
GPU &gpu = *realGpu;
//forgive the gyrations, some of this junk in here is to remind us of gyrations we might have to go
//through to avoid breaking the gpu struct
gpu.currBgNum = map;
gpu.debug = true;
for(u32 i = 0; i < gpu.BGSize[map][1]; ++i)
{
gpu.currDst = (u8 *)bitmap + i*gpu.BGSize[map][0]*2;
gpu.currLine = i;
gpu.modeRender<false>(map);
}
gpu.debug = false;
}
};
mapview_struct *MapView = NULL;
LRESULT MapView_OnPaint(mapview_struct * win, HWND hwnd, WPARAM wParam, LPARAM lParam)
{
Lock lock;
@ -135,94 +161,12 @@ LRESULT MapView_OnPaint(mapview_struct * win, HWND hwnd, WPARAM wParam, LPARAM l
sprintf(text, "%d x %d", parms->BGxPC, parms->BGxPD);
SetWindowText(GetDlgItem(hwnd, IDC_SCROLL), text);
// memset(win->bitmap, 0, sizeof(win->bitmap));
for(int i = 0; i < (1024*1024); i++)
win->bitmap[i] = 0x7C1F;
if(win->lcd)
{
switch(dispcnt & 7)
{
case 0:
textBG(SubScreen.gpu, win->map, (u8 *)win->bitmap);
break;
case 1:
if (win->map < 3)
textBG(SubScreen.gpu, win->map, (u8 *)win->bitmap);
else
rotBG(SubScreen.gpu, win->map, (u8 *)win->bitmap);
break;
case 2:
if (win->map < 2)
textBG(SubScreen.gpu, win->map, (u8 *)win->bitmap);
else
rotBG(SubScreen.gpu, win->map, (u8 *)win->bitmap);
break;
case 3:
if (win->map < 3)
textBG(SubScreen.gpu, win->map, (u8 *)win->bitmap);
else
extRotBG(SubScreen.gpu, win->map, (u8 *)win->bitmap);
break;
case 4:
if (win->map < 2)
textBG(SubScreen.gpu, win->map, (u8 *)win->bitmap);
else if (win->map < 3)
rotBG(SubScreen.gpu, win->map, (u8 *)win->bitmap);
else
extRotBG(SubScreen.gpu, win->map, (u8 *)win->bitmap);
break;
case 5:
if (win->map < 2)
textBG(SubScreen.gpu, win->map, (u8 *)win->bitmap);
else
extRotBG(SubScreen.gpu, win->map, (u8 *)win->bitmap);
break;
}
}
else
{
switch(dispcnt & 7)
{
case 0:
textBG(MainScreen.gpu, win->map, (u8 *)win->bitmap);
break;
case 1:
if (win->map < 3)
textBG(MainScreen.gpu, win->map, (u8 *)win->bitmap);
else
rotBG(MainScreen.gpu, win->map, (u8 *)win->bitmap);
break;
case 2:
if (win->map < 2)
textBG(MainScreen.gpu, win->map, (u8 *)win->bitmap);
else
rotBG(MainScreen.gpu, win->map, (u8 *)win->bitmap);
break;
case 3:
if (win->map < 3)
textBG(MainScreen.gpu, win->map, (u8 *)win->bitmap);
else
extRotBG(MainScreen.gpu, win->map, (u8 *)win->bitmap);
break;
case 4:
if (win->map < 2)
textBG(MainScreen.gpu, win->map, (u8 *)win->bitmap);
else if (win->map < 3)
rotBG(MainScreen.gpu, win->map, (u8 *)win->bitmap);
else
extRotBG(MainScreen.gpu, win->map, (u8 *)win->bitmap);
break;
case 5:
if (win->map < 2)
textBG(MainScreen.gpu, win->map, (u8 *)win->bitmap);
else
extRotBG(MainScreen.gpu, win->map, (u8 *)win->bitmap);
break;
}
}
win->render();
SetDIBitsToDevice(hdc, 200, 4, lg, ht, 0, 0, 0, ht, win->bitmap, (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
//SetDIBitsToDevice(hdc, 200, 4, 256, 192, 0, 0, 0, 192, win->bitmap, (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
EndPaint(hwnd, &ps);