-files now compile in VC++

This commit is contained in:
cyberwarriorx 2006-11-30 21:43:48 +00:00
parent 63614f864e
commit af06f98596
9 changed files with 140 additions and 128 deletions

View File

@ -27,7 +27,7 @@ cwindow_struct *updatewindowlist = NULL;
//////////////////////////////////////////////////////////////////////////////
int CWindow_Init(void *win, HINSTANCE hInst, const char * cname, const char * title, int style, int sx, int sy, LRESULT CALLBACK (* wP) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam))
int CWindow_Init(void *win, HINSTANCE hInst, const char * cname, const char * title, int style, int sx, int sy, WNDPROC wP)
{
static BOOL first = FALSE;
RECT clientaera;
@ -95,7 +95,7 @@ int CWindow_Init(void *win, HINSTANCE hInst, const char * cname, const char * ti
//////////////////////////////////////////////////////////////////////////////
int CWindow_Init2(void *win, HINSTANCE hInst, HWND parent, char * title, int ID, BOOL CALLBACK (*wP) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam))
int CWindow_Init2(void *win, HINSTANCE hInst, HWND parent, char * title, int ID, DLGPROC wP)
{
cwindow_struct *win2=(cwindow_struct *)win;

View File

@ -37,8 +37,8 @@ typedef struct
void (*Refresh)(void *win);
} cwindow_struct;
int CWindow_Init(void *win, HINSTANCE hInst, const char * cname, const char * title, int style, int sx, int sy, LRESULT CALLBACK (* wP) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam));
int CWindow_Init2(void *win, HINSTANCE hInst, HWND parent, char * title, int ID, BOOL CALLBACK (*wP) (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam));
int CWindow_Init(void *win, HINSTANCE hInst, const char * cname, const char * title, int style, int sx, int sy, WNDPROC wP);
int CWindow_Init2(void *win, HINSTANCE hInst, HWND parent, char * title, int ID, DLGPROC wP);
void CWindow_Show(void *win);
void CWindow_Hide(void *win);
void CWindow_Refresh(void *win);

View File

@ -69,9 +69,10 @@ void GetINIPath(char *inipath)
szPath = vPath;
else
{
char *p;
ZeroMemory(vPath, sizeof(vPath));
GetModuleFileName(NULL, vPath, sizeof(vPath));
char *p = vPath + lstrlen(vPath);
p = vPath + lstrlen(vPath);
while (p >= vPath && *p != '\\') p--;
if (++p >= vPath) *p = 0;
szPath = vPath;

View File

@ -411,16 +411,21 @@ LRESULT DisViewBox_OnPaint(disview_struct *win, WPARAM wParam, LPARAM lParam)
SIZE fontsize;
TCHAR text[100];
TCHAR txt[100];
RECT rect;
int lg;
int ht;
HDC mem_dc;
HBITMAP mem_bmp;
u32 nbligne;
GetClientRect(hwnd, &rect);
int lg = rect.right - rect.left;
int ht = rect.bottom - rect.top;
lg = rect.right - rect.left;
ht = rect.bottom - rect.top;
hdc = BeginPaint(hwnd, &ps);
HDC mem_dc = CreateCompatibleDC(hdc);
HBITMAP mem_bmp = CreateCompatibleBitmap(hdc, lg, ht);
mem_dc = CreateCompatibleDC(hdc);
mem_bmp = CreateCompatibleBitmap(hdc, lg, ht);
SelectObject(mem_dc, mem_bmp);
FillRect(mem_dc, &rect, (HBRUSH)GetStockObject(WHITE_BRUSH));
@ -429,7 +434,7 @@ LRESULT DisViewBox_OnPaint(disview_struct *win, WPARAM wParam, LPARAM lParam)
GetTextExtentPoint32(mem_dc, "0", 1, &fontsize);
u32 nbligne = ht/fontsize.cy;
nbligne = ht/fontsize.cy;
SetTextColor(mem_dc, RGB(0,0,0));
@ -591,12 +596,16 @@ LRESULT CALLBACK DisViewBoxWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
{
RECT rect;
SIZE fontsize;
HDC dc;
HFONT old;
int nbligne;
GetClientRect(hwnd, &rect);
HDC dc = GetDC(hwnd);
HFONT old = (HFONT)SelectObject(dc, GetStockObject(SYSTEM_FIXED_FONT));
dc = GetDC(hwnd);
old = (HFONT)SelectObject(dc, GetStockObject(SYSTEM_FIXED_FONT));
GetTextExtentPoint32(dc, "0", 1, &fontsize);
int nbligne = (rect.bottom - rect.top)/fontsize.cy;
nbligne = (rect.bottom - rect.top)/fontsize.cy;
switch LOWORD(wParam)
{
@ -686,20 +695,21 @@ BOOL CALLBACK DisView_Proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPara
return 1;
case IDC_STEP :
{
BITMAPV4HEADER bmi;
BITMAPV4HEADER bmi;
int ndstep;
//CreateBitmapIndirect(&bmi);
memset(&bmi, 0, sizeof(bmi));
bmi.bV4Size = sizeof(bmi);
bmi.bV4Planes = 1;
bmi.bV4BitCount = 16;
bmi.bV4V4Compression = BI_RGB|BI_BITFIELDS;
bmi.bV4RedMask = 0x001F;
bmi.bV4GreenMask = 0x03E0;
bmi.bV4BlueMask = 0x7C00;
bmi.bV4Width = 256;
bmi.bV4Height = -192;
int ndstep = GetDlgItemInt(hwnd, IDC_SETPNUM, NULL, FALSE);
//CreateBitmapIndirect(&bmi);
memset(&bmi, 0, sizeof(bmi));
bmi.bV4Size = sizeof(bmi);
bmi.bV4Planes = 1;
bmi.bV4BitCount = 16;
bmi.bV4V4Compression = BI_RGB|BI_BITFIELDS;
bmi.bV4RedMask = 0x001F;
bmi.bV4GreenMask = 0x03E0;
bmi.bV4BlueMask = 0x7C00;
bmi.bV4Width = 256;
bmi.bV4Height = -192;
ndstep = GetDlgItemInt(hwnd, IDC_SETPNUM, NULL, FALSE);
NDS_exec(ndstep, TRUE);
if(!win->autoup) win->Refresh(win);
CWindow_RefreshALL();

View File

@ -255,9 +255,9 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
{
MSG messages; /* Here messages to the application are saved */
hAppInst=hThisInstance;
char text[80];
cwindow_struct MainWindow;
hAppInst=hThisInstance;
InitializeCriticalSection(&section);
sprintf(text, "DeSmuME v%s", VERSION);
@ -534,9 +534,11 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
case WM_LBUTTONDOWN:
if(HIWORD(lParam)>=192)
{
s32 x;
s32 y;
SetCapture(hwnd);
s32 x = LOWORD(lParam);
s32 y = HIWORD(lParam) - 192;
x = LOWORD(lParam);
y = HIWORD(lParam) - 192;
if(x<0) x = 0; else if(x>255) x = 255;
if(y<0) y = 0; else if(y>192) y = 192;
NDS_setTouchPos(x, y);
@ -553,10 +555,10 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
{
case IDM_OPEN:
{
NDS_Pause(); //Stop emulation while opening new rom
OPENFILENAME ofn;
char filename[MAX_PATH] = "";
NDS_Pause(); //Stop emulation while opening new rom
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
@ -574,21 +576,6 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
LOG("%s\r\n", filename);
/* // This should be moved to NDSSystem.c
// Added for FAT generation
// Mic
if (ofn.nFileOffset>0) {
strncpy(szRomPath,filename,ofn.nFileOffset-1);
cflash_close();
cflash_init();
}
strcpy(SavName,filename);
romnum+=1;
*/
if(LoadROM(filename))
{
EnableMenuItem(menu, IDM_EXEC, MF_GRAYED);
@ -621,9 +608,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
return 0;
case IDM_STATE_LOAD:
{
NDS_Pause();
OPENFILENAME ofn;
//char nomFichier[MAX_PATH] = "";
NDS_Pause();
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
@ -635,20 +621,18 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
if(!GetOpenFileName(&ofn))
{
NDS_UnPause();
return 0;
}
//log::ajouter(SavName);
savestate_load(SavName);
NDS_UnPause();
}
return 0;
case IDM_STATE_SAVE:
{
NDS_Pause();
OPENFILENAME ofn;
//char nomFichier[MAX_PATH] = "";
NDS_Pause();
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
@ -663,16 +647,6 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
return 0;
}
//strncpy(SavName + "dst", FileName, strlen(FileName)-3);
//strcpy(SavName, SavName + "dst");
//log = "sram saved to: ";
//strcat(log, (const char*)SavName);
//log::ajouter(log);
//strncpy(SavName2, SavName, strlen(SavName)-3);
//strncat(SavName2, "dst", 3);
//strcpy(SavName, SavName + "dst");
savestate_save(SavName);
NDS_UnPause();
}

View File

@ -35,33 +35,32 @@ LRESULT MapView_OnPaint(mapview_struct * win, HWND hwnd, WPARAM wParam, LPARAM l
char text[80];
u32 dispcnt = ((volatile u32 *)ARM9Mem.ARM9_REG)[(win->lcd*0x400)];
u32 bgcnt = ((volatile u16 *)ARM9Mem.ARM9_REG)[(8 + (win->map<<1) + (win->lcd*0x1000))>>1];
BITMAPV4HEADER bmi;
u16 lg;
u16 ht;
//CreateBitmapIndirect(&bmi);
memset(&bmi, 0, sizeof(bmi));
bmi.bV4Size = sizeof(bmi);
bmi.bV4Planes = 1;
bmi.bV4BitCount = 16;
bmi.bV4V4Compression = BI_RGB|BI_BITFIELDS;
bmi.bV4RedMask = 0x001F;
bmi.bV4GreenMask = 0x03E0;
bmi.bV4BlueMask = 0x7C00;
BITMAPV4HEADER bmi;
//CreateBitmapIndirect(&bmi);
memset(&bmi, 0, sizeof(bmi));
bmi.bV4Size = sizeof(bmi);
bmi.bV4Planes = 1;
bmi.bV4BitCount = 16;
bmi.bV4V4Compression = BI_RGB|BI_BITFIELDS;
bmi.bV4RedMask = 0x001F;
bmi.bV4GreenMask = 0x03E0;
bmi.bV4BlueMask = 0x7C00;
u16 lg;
u16 ht;
if(win->lcd)
{
lg = SubScreen.gpu->BGSize[win->map][0];
ht = SubScreen.gpu->BGSize[win->map][1];
}
else
{
lg = MainScreen.gpu->BGSize[win->map][0];
ht = MainScreen.gpu->BGSize[win->map][1];
}
bmi.bV4Width = lg;
bmi.bV4Height = -ht;
if(win->lcd)
{
lg = SubScreen.gpu->BGSize[win->map][0];
ht = SubScreen.gpu->BGSize[win->map][1];
}
else
{
lg = MainScreen.gpu->BGSize[win->map][0];
ht = MainScreen.gpu->BGSize[win->map][1];
}
bmi.bV4Width = lg;
bmi.bV4Height = -ht;
hdc = BeginPaint(hwnd, &ps);
@ -105,11 +104,11 @@ LRESULT MapView_OnPaint(mapview_struct * win, HWND hwnd, WPARAM wParam, LPARAM l
SetWindowText(GetDlgItem(hwnd, IDC_SCROLL), text);
if(win->lcd)
textBG(SubScreen.gpu, win->map, win->bitmap);
textBG(SubScreen.gpu, win->map, (u8 *)win->bitmap);
//rotBG(SubScreen.gpu, win->map, win->bitmap);
//extRotBG(SubScreen.gpu, win->map, win->bitmap);
else
textBG(MainScreen.gpu, win->map, win->bitmap);
textBG(MainScreen.gpu, win->map, (u8 *)win->bitmap);
//rotBG(MainScreen.gpu, win->map, win->bitmap);
//extRotBG(MainScreen.gpu, win->map, win->bitmap);

View File

@ -301,16 +301,23 @@ LRESULT MemViewBox_OnPaint(memview_struct * win, WPARAM wParam, LPARAM lParam)
SIZE fontsize;
TCHAR text[80];
int i;
RECT rect;
int lg;
int ht;
HDC mem_dc;
HBITMAP mem_bmp;
int nbligne;
RECT r;
u32 adr;
GetClientRect(hwnd, &rect);
int lg = rect.right - rect.left;
int ht = rect.bottom - rect.top;
lg = rect.right - rect.left;
ht = rect.bottom - rect.top;
hdc = BeginPaint(hwnd, &ps);
HDC mem_dc = CreateCompatibleDC(hdc);
HBITMAP mem_bmp = CreateCompatibleBitmap(hdc, lg, ht);
mem_dc = CreateCompatibleDC(hdc);
mem_bmp = CreateCompatibleBitmap(hdc, lg, ht);
SelectObject(mem_dc, mem_bmp);
FillRect(mem_dc, &rect, (HBRUSH)GetStockObject(WHITE_BRUSH));
@ -319,25 +326,23 @@ LRESULT MemViewBox_OnPaint(memview_struct * win, WPARAM wParam, LPARAM lParam)
GetTextExtentPoint32(mem_dc, "0", 1, &fontsize);
int nbligne = ht/fontsize.cy;
nbligne = ht/fontsize.cy;
SetTextColor(mem_dc, RGB(0,0,0));
RECT r;
r.top = 3;
r.left = 3;
r.bottom = r.top+fontsize.cy;
r.right = rect.right-3;
u32 adr = win->curr_ligne*0x10;
adr = win->curr_ligne*0x10;
for(i=0; i<nbligne; ++i)
{
int j;
sprintf(text, "%04X:%04X", (int)(adr>>16), (int)(adr&0xFFFF));
DrawText(mem_dc, text, -1, &r, DT_TOP | DT_LEFT | DT_NOPREFIX);
r.left += 11*fontsize.cx;
int j;
if(win->representation == 0)
for(j=0; j<16; ++j)
@ -417,12 +422,16 @@ LRESULT CALLBACK MemViewBoxWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP
{
RECT rect;
SIZE fontsize;
HDC dc;
HFONT old;
int nbligne;
GetClientRect(hwnd, &rect);
HDC dc = GetDC(hwnd);
HFONT old = (HFONT)SelectObject(dc, GetStockObject(SYSTEM_FIXED_FONT));
dc = GetDC(hwnd);
old = (HFONT)SelectObject(dc, GetStockObject(SYSTEM_FIXED_FONT));
GetTextExtentPoint32(dc, "0", 1, &fontsize);
int nbligne = (rect.bottom - rect.top)/fontsize.cy;
nbligne = (rect.bottom - rect.top)/fontsize.cy;
switch LOWORD(wParam)
{

View File

@ -71,16 +71,20 @@ LRESULT OAMViewBox_OnPaint(oamview_struct * win, WPARAM wParam, LPARAM lParam)
HDC hdc;
PAINTSTRUCT ps;
// TCHAR text[80];
RECT rect;
int lg;
int ht;
HDC mem_dc;
HBITMAP mem_bmp;
GetClientRect(hwnd, &rect);
int lg = rect.right - rect.left;
int ht = rect.bottom - rect.top;
lg = rect.right - rect.left;
ht = rect.bottom - rect.top;
hdc = BeginPaint(hwnd, &ps);
HDC mem_dc = CreateCompatibleDC(hdc);
HBITMAP mem_bmp = CreateCompatibleBitmap(hdc, lg, ht);
mem_dc = CreateCompatibleDC(hdc);
mem_bmp = CreateCompatibleBitmap(hdc, lg, ht);
SelectObject(mem_dc, mem_bmp);
FillRect(mem_dc, &rect, (HBRUSH)GetStockObject(WHITE_BRUSH));
@ -131,6 +135,7 @@ LRESULT OamView_OnPaint(oamview_struct *win, WPARAM wParam, LPARAM lParam)
u8 prio[256*192];
BITMAPV4HEADER bmi;
u16 i;
s16 x;
//CreateBitmapIndirect(&bmi);
memset(&bmi, 0, sizeof(bmi));
@ -181,8 +186,8 @@ LRESULT OamView_OnPaint(oamview_struct *win, WPARAM wParam, LPARAM lParam)
sprintf(text, "%d 0x%08X", (oam->attr2>>10)&3, oam->attr2);
SetWindowText(GetDlgItem(hwnd, IDC_PRIO), text);
signed short x = oam->attr1&0x1FF;
x = ((signed short)(x<<7)>>7);
x = oam->attr1&0x1FF;
x = ((s16)(x<<7)>>7);
sprintf(text, "%d x %d", x, oam->attr0&0xFF);
SetWindowText(GetDlgItem(hwnd, IDC_COOR), text);
@ -204,7 +209,7 @@ LRESULT OamView_OnPaint(oamview_struct *win, WPARAM wParam, LPARAM lParam)
if(oam->attr0&(1<<9))
sprintf(text, "INVISIBLE");
else
sprintf(text, "%s %s", oam->attr0&(1<<12)?"H FLIP":"", oam->attr0&(1<<12)?"V FLIP":"");
sprintf(text, "%s %s", oam->attr0&(1<<12)?"H FLIP":"", oam->attr0&(1<<13)?"V FLIP":"");
SetWindowText(GetDlgItem(hwnd, IDC_PROP0), text);

View File

@ -121,6 +121,11 @@ LRESULT TileViewBox_Direct(tileview_struct * win, WPARAM wParam, LPARAM lParam)
// SIZE fontsize;
// TCHAR text[80];
BITMAPV4HEADER bmi;
RECT rect;
HDC mem_dc;
HBITMAP mem_bmp;
int lg;
int ht;
memset(&bmi, 0, sizeof(bmi));
bmi.bV4Size = sizeof(bmi);
@ -133,15 +138,14 @@ LRESULT TileViewBox_Direct(tileview_struct * win, WPARAM wParam, LPARAM lParam)
bmi.bV4Width = 256;
bmi.bV4Height = -256;
RECT rect;
GetClientRect(hwnd, &rect);
int lg = rect.right - rect.left;
int ht = rect.bottom - rect.top;
lg = rect.right - rect.left;
ht = rect.bottom - rect.top;
hdc = BeginPaint(hwnd, &ps);
HDC mem_dc = CreateCompatibleDC(hdc);
HBITMAP mem_bmp = CreateCompatibleBitmap(hdc, lg, ht);
mem_dc = CreateCompatibleDC(hdc);
mem_bmp = CreateCompatibleBitmap(hdc, lg, ht);
SelectObject(mem_dc, mem_bmp);
FillRect(mem_dc, &rect, (HBRUSH)GetStockObject(WHITE_BRUSH));
@ -169,6 +173,12 @@ LRESULT TileViewBox_Pal256(tileview_struct * win, WPARAM wParam, LPARAM lParam)
u16 bitmap[256*256];
u16 * pal = ((u16 *)win->pal) + win->palnum*256;
BITMAPV4HEADER bmi;
RECT rect;
int lg;
int ht;
HDC mem_dc;
HBITMAP mem_bmp;
memset(&bmi, 0, sizeof(bmi));
bmi.bV4Size = sizeof(bmi);
bmi.bV4Planes = 1;
@ -180,15 +190,14 @@ LRESULT TileViewBox_Pal256(tileview_struct * win, WPARAM wParam, LPARAM lParam)
bmi.bV4Width = 256;
bmi.bV4Height = -256;
RECT rect;
GetClientRect(hwnd, &rect);
int lg = rect.right - rect.left;
int ht = rect.bottom - rect.top;
lg = rect.right - rect.left;
ht = rect.bottom - rect.top;
hdc = BeginPaint(hwnd, &ps);
HDC mem_dc = CreateCompatibleDC(hdc);
HBITMAP mem_bmp = CreateCompatibleBitmap(hdc, lg, ht);
mem_dc = CreateCompatibleDC(hdc);
mem_bmp = CreateCompatibleBitmap(hdc, lg, ht);
SelectObject(mem_dc, mem_bmp);
FillRect(mem_dc, &rect, (HBRUSH)GetStockObject(WHITE_BRUSH));
@ -232,6 +241,12 @@ LRESULT TileViewBox_Pal16(tileview_struct * win, WPARAM wParam, LPARAM lParam)
u16 bitmap[512*512];
u16 * pal = ((u16 *)win->pal) + win->palnum*16;
BITMAPV4HEADER bmi;
RECT rect;
int lg;
int ht;
HDC mem_dc;
HBITMAP mem_bmp;
memset(&bmi, 0, sizeof(bmi));
bmi.bV4Size = sizeof(bmi);
bmi.bV4Planes = 1;
@ -243,15 +258,14 @@ LRESULT TileViewBox_Pal16(tileview_struct * win, WPARAM wParam, LPARAM lParam)
bmi.bV4Width = 512;
bmi.bV4Height = -256;
RECT rect;
GetClientRect(hwnd, &rect);
int lg = rect.right - rect.left;
int ht = rect.bottom - rect.top;
lg = rect.right - rect.left;
ht = rect.bottom - rect.top;
hdc = BeginPaint(hwnd, &ps);
HDC mem_dc = CreateCompatibleDC(hdc);
HBITMAP mem_bmp = CreateCompatibleBitmap(hdc, 512, 256);
mem_dc = CreateCompatibleDC(hdc);
mem_bmp = CreateCompatibleBitmap(hdc, 512, 256);
SelectObject(mem_dc, mem_bmp);
FillRect(mem_dc, &rect, (HBRUSH)GetStockObject(WHITE_BRUSH));