win32:
- fix some bugs in OAM viewer and add scale thumb viewer;
This commit is contained in:
parent
04aac479df
commit
e4c0154dd8
|
@ -37,16 +37,39 @@ typedef struct
|
||||||
s16 num;
|
s16 num;
|
||||||
OAM *oam;
|
OAM *oam;
|
||||||
GPU *gpu;
|
GPU *gpu;
|
||||||
|
u8 scale;
|
||||||
|
bool border;
|
||||||
} oamview_struct;
|
} oamview_struct;
|
||||||
|
|
||||||
oamview_struct *OAMView = NULL;
|
oamview_struct *OAMView = NULL;
|
||||||
|
|
||||||
|
HBRUSH bhScyx = NULL;
|
||||||
|
HBRUSH bhBack = NULL;
|
||||||
|
RECT rcThumb = {0, 0, 0, 0};
|
||||||
|
|
||||||
const char dimm[4][4][8] =
|
const char dimm[4][4][8] =
|
||||||
{
|
{
|
||||||
{"8 x 8", "16 x 8", "8 x 16", "- x -"},
|
{"8 x 8", "16 x 8", "8 x 16", "- x -"},
|
||||||
{"16 x 16", "32 x 8", "8 x 32", "- x -"},
|
{"16 x 16", "32 x 8", "8 x 32", "- x -"},
|
||||||
{"32 x 32", "32 x 16", "16 x 32", "- x -"},
|
{"32 x 32", "32 x 16", "16 x 32", "- x -"},
|
||||||
{"64 x 64", "64 x 32", "32 x 64", "- x -"},
|
{"64 x 64", "64 x 32", "32 x 64", "- x -"}
|
||||||
|
};
|
||||||
|
|
||||||
|
const u8 dimm_int[4][4][2] =
|
||||||
|
{
|
||||||
|
{{8,8}, {16,8}, {8,16}, {0,0}},
|
||||||
|
{{16,16}, {32,8}, {8,32}, {0,0}},
|
||||||
|
{{32,32}, {32,16}, {16,32}, {0,0}},
|
||||||
|
{{64,64}, {64,32}, {32,64}, {0,0}}
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SIZE_THUMB 128
|
||||||
|
const u8 max_scale[4][4] =
|
||||||
|
{
|
||||||
|
{SIZE_THUMB/8, SIZE_THUMB/16, SIZE_THUMB/16, 0},
|
||||||
|
{SIZE_THUMB/16, SIZE_THUMB/32, SIZE_THUMB/32, 0},
|
||||||
|
{SIZE_THUMB/32, SIZE_THUMB/32, SIZE_THUMB/32, 0},
|
||||||
|
{SIZE_THUMB/64, SIZE_THUMB/64, SIZE_THUMB/64, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
LRESULT OAMViewBox_OnPaint(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
LRESULT OAMViewBox_OnPaint(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
@ -97,7 +120,7 @@ LRESULT OamView_OnPaint(HWND hwnd, oamview_struct *win, WPARAM wParam, LPARAM lP
|
||||||
u8 prio[256*192];
|
u8 prio[256*192];
|
||||||
BITMAPV4HEADER bmi;
|
BITMAPV4HEADER bmi;
|
||||||
u16 i;
|
u16 i;
|
||||||
s16 x;
|
s16 x = 0, y = 0;
|
||||||
|
|
||||||
//CreateBitmapIndirect(&bmi);
|
//CreateBitmapIndirect(&bmi);
|
||||||
memset(&bmi, 0, sizeof(bmi));
|
memset(&bmi, 0, sizeof(bmi));
|
||||||
|
@ -139,20 +162,26 @@ LRESULT OamView_OnPaint(HWND hwnd, oamview_struct *win, WPARAM wParam, LPARAM lP
|
||||||
SetWindowText(GetDlgItem(hwnd, IDC_MODE), "Bitmap");
|
SetWindowText(GetDlgItem(hwnd, IDC_MODE), "Bitmap");
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(text, "0x%08X", oam->attr0/*oam->attr2&0x3FF*/);
|
sprintf(text, "%04X", oam->attr2&0x3FF);
|
||||||
SetWindowText(GetDlgItem(hwnd, IDC_TILE), text);
|
SetWindowText(GetDlgItem(hwnd, IDC_TILE), text);
|
||||||
|
|
||||||
sprintf(text, "0x%08X", oam->attr1/*oam->attr2&0x3FF*/);
|
if (oam->attr0&(1<<13))
|
||||||
|
{
|
||||||
|
sprintf(text, "256 colors");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(text, "16 colors:%2i", (oam->attr2>>12)&0xFF);
|
||||||
|
}
|
||||||
SetWindowText(GetDlgItem(hwnd, IDC_PAL), text);
|
SetWindowText(GetDlgItem(hwnd, IDC_PAL), text);
|
||||||
|
|
||||||
//SetWindowText(GetDlgItem(hwnd, IDC_PAL), (oam->attr0&(1<<13))?"256 couleurs": "16 couleurs");
|
sprintf(text, "%d", (oam->attr2>>10)&3);
|
||||||
|
|
||||||
sprintf(text, "%d 0x%08X", (oam->attr2>>10)&3, oam->attr2);
|
|
||||||
SetWindowText(GetDlgItem(hwnd, IDC_PRIO), text);
|
SetWindowText(GetDlgItem(hwnd, IDC_PRIO), text);
|
||||||
|
|
||||||
x = oam->attr1&0x1FF;
|
x = oam->attr1&0x1FF;
|
||||||
x = ((s16)(x<<7)>>7);
|
x = ((s16)(x<<7)>>7);
|
||||||
sprintf(text, "%d x %d", x, oam->attr0&0xFF);
|
y=oam->attr0&0xFF;
|
||||||
|
sprintf(text, "%d x %d", x, y);
|
||||||
SetWindowText(GetDlgItem(hwnd, IDC_COOR), text);
|
SetWindowText(GetDlgItem(hwnd, IDC_COOR), text);
|
||||||
|
|
||||||
SetWindowText(GetDlgItem(hwnd, IDC_DIM), dimm[oam->attr1>>14][oam->attr0>>14]);
|
SetWindowText(GetDlgItem(hwnd, IDC_DIM), dimm[oam->attr1>>14][oam->attr0>>14]);
|
||||||
|
@ -173,7 +202,7 @@ LRESULT OamView_OnPaint(HWND hwnd, oamview_struct *win, WPARAM wParam, LPARAM lP
|
||||||
if(oam->attr0&(1<<9))
|
if(oam->attr0&(1<<9))
|
||||||
sprintf(text, "INVISIBLE");
|
sprintf(text, "INVISIBLE");
|
||||||
else
|
else
|
||||||
sprintf(text, "%s %s", oam->attr0&(1<<12)?"H FLIP":"", oam->attr0&(1<<13)?"V FLIP":"");
|
sprintf(text, "%s %s", oam->attr1&(1<<12)?"H FLIP":"", oam->attr1&(1<<13)?"V FLIP":"");
|
||||||
|
|
||||||
SetWindowText(GetDlgItem(hwnd, IDC_PROP0), text);
|
SetWindowText(GetDlgItem(hwnd, IDC_PROP0), text);
|
||||||
|
|
||||||
|
@ -187,8 +216,22 @@ LRESULT OamView_OnPaint(HWND hwnd, oamview_struct *win, WPARAM wParam, LPARAM lP
|
||||||
copy.spriteRender((u8*)(bitmap + i*256), bitmap_alpha + i*256, type + i*256, prio + i*256);
|
copy.spriteRender((u8*)(bitmap + i*256), bitmap_alpha + i*256, type + i*256, prio + i*256);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 width = dimm_int[(oam->attr1>>14)][(oam->attr0>>14)][0];
|
||||||
|
u32 height = dimm_int[(oam->attr1>>14)][(oam->attr0>>14)][1];
|
||||||
|
RECT rc = {180 + x, 4 + y, 180 + x + width, 4 + y + height};
|
||||||
|
|
||||||
SetDIBitsToDevice(hdc, 180, 4, 256, 192, 0, 0, 0, 192, bitmap, (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
|
SetDIBitsToDevice(hdc, 180, 4, 256, 192, 0, 0, 0, 192, bitmap, (BITMAPINFO*)&bmi, DIB_RGB_COLORS);
|
||||||
|
|
||||||
|
u8 max = max_scale[oam->attr1>>14][oam->attr0>>14];
|
||||||
|
u8 tmp_scale = (win->scale > max)?max:win->scale;
|
||||||
|
u32 w2 = width*tmp_scale;
|
||||||
|
u32 h2 = height*tmp_scale;
|
||||||
|
FillRect(hdc, &rcThumb, bhBack);
|
||||||
|
StretchBlt(hdc, (436-SIZE_THUMB/2)-(w2/2), (200+SIZE_THUMB/2)-(h2/2), w2, h2, hdc, rc.left, rc.top, width, height, SRCCOPY);
|
||||||
|
|
||||||
|
if (win->border)
|
||||||
|
FrameRect(hdc, &rc, bhScyx);
|
||||||
|
|
||||||
EndPaint(hwnd, &ps);
|
EndPaint(hwnd, &ps);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -227,6 +270,8 @@ BOOL CALLBACK ViewOAMProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
|
||||||
memset(OAMView, 0, sizeof(oamview_struct));
|
memset(OAMView, 0, sizeof(oamview_struct));
|
||||||
OAMView->oam = (OAM *)(MMU.ARM9_OAM);
|
OAMView->oam = (OAM *)(MMU.ARM9_OAM);
|
||||||
OAMView->gpu = MainScreen.gpu;
|
OAMView->gpu = MainScreen.gpu;
|
||||||
|
OAMView->scale = 2;
|
||||||
|
OAMView->border = true;
|
||||||
|
|
||||||
OAMView->autoup_secs = 1;
|
OAMView->autoup_secs = 1;
|
||||||
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
SendMessage(GetDlgItem(hwnd, IDC_AUTO_UPDATE_SPIN),
|
||||||
|
@ -238,6 +283,13 @@ BOOL CALLBACK ViewOAMProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
|
||||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main screen sprite");
|
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Main screen sprite");
|
||||||
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub screen sprite");
|
SendMessage(combo, CB_ADDSTRING, 0,(LPARAM)"Sub screen sprite");
|
||||||
SendMessage(combo, CB_SETCURSEL, 0, 0);
|
SendMessage(combo, CB_SETCURSEL, 0, 0);
|
||||||
|
|
||||||
|
bhScyx = CreateSolidBrush(RGB(255,0,0));
|
||||||
|
bhBack = CreateSolidBrush(RGB(123,198,255));
|
||||||
|
SetRect(&rcThumb, 436-SIZE_THUMB, 200, 436, 200+SIZE_THUMB);
|
||||||
|
|
||||||
|
SendMessage(GetDlgItem(hwnd, IDC_S2X), BM_SETCHECK, true, 0);
|
||||||
|
SendMessage(GetDlgItem(hwnd, IDC_BORDER), BM_SETCHECK, true, 0);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
case WM_CLOSE :
|
case WM_CLOSE :
|
||||||
|
@ -253,6 +305,8 @@ BOOL CALLBACK ViewOAMProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
|
||||||
delete OAMView;
|
delete OAMView;
|
||||||
OAMView = NULL;
|
OAMView = NULL;
|
||||||
}
|
}
|
||||||
|
DeleteObject(bhScyx);
|
||||||
|
DeleteObject(bhBack);
|
||||||
//INFO("Close OAM viewer dialog\n");
|
//INFO("Close OAM viewer dialog\n");
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -270,14 +324,15 @@ BOOL CALLBACK ViewOAMProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
|
||||||
++(OAMView->num);
|
++(OAMView->num);
|
||||||
if(OAMView->num>127)
|
if(OAMView->num>127)
|
||||||
OAMView->num = 127;
|
OAMView->num = 127;
|
||||||
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
break;
|
break;
|
||||||
case SB_LINELEFT :
|
case SB_LINELEFT :
|
||||||
--(OAMView->num);
|
--(OAMView->num);
|
||||||
if(OAMView->num<0)
|
if(OAMView->num<0)
|
||||||
OAMView->num = 0;
|
OAMView->num = 0;
|
||||||
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
InvalidateRect(hwnd, NULL, FALSE);
|
|
||||||
return 1;
|
return 1;
|
||||||
case WM_COMMAND :
|
case WM_COMMAND :
|
||||||
switch (LOWORD (wParam))
|
switch (LOWORD (wParam))
|
||||||
|
@ -342,6 +397,27 @@ BOOL CALLBACK ViewOAMProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
case IDC_S2X:
|
||||||
|
OAMView->scale = 2;
|
||||||
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
|
return 1;
|
||||||
|
case IDC_S4X:
|
||||||
|
OAMView->scale = 4;
|
||||||
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
|
return 1;
|
||||||
|
case IDC_S8X:
|
||||||
|
OAMView->scale = 8;
|
||||||
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
|
return 1;
|
||||||
|
case IDC_S16X:
|
||||||
|
OAMView->scale = 16;
|
||||||
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
|
return 1;
|
||||||
|
case IDC_BORDER:
|
||||||
|
OAMView->border = (IsDlgButtonChecked(hwnd, IDC_BORDER) == BST_CHECKED);
|
||||||
|
InvalidateRect(hwnd, NULL, FALSE);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue