diff --git a/Source/Project64/N64 System/C Core/BreakPoints.cpp b/Source/Project64/N64 System/C Core/BreakPoints.cpp deleted file mode 100644 index 278e15d48..000000000 --- a/Source/Project64/N64 System/C Core/BreakPoints.cpp +++ /dev/null @@ -1,548 +0,0 @@ -#include "stdafx.h" - -#ifdef tofix -/* - * Project 64 - A Nintendo 64 emulator. - * - * (c) Copyright 2001 zilmar (zilmar@emulation64.com) and - * Jabo (jabo@emulation64.com). - * - * pj64 homepage: www.pj64.net - * - * Permission to use, copy, modify and distribute Project64 in both binary and - * source form, for non-commercial purposes, is hereby granted without fee, - * providing that this license information and copyright notice appear with - * all copies and any derived work. - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event shall the authors be held liable for any damages - * arising from the use of this software. - * - * Project64 is freeware for PERSONAL USE only. Commercial users should - * seek permission of the copyright holders first. Commercial use includes - * charging money for Project64 or software derived from Project64. - * - * The copyright holders request that bug fixes and improvements to the code - * should be forwarded to them so if they want them. - * - */ -#include "main.h" -#include "CPU.h" -#include "debugger.h" -#include "plugin.h" - -int CheckForR4300iBPoint ( DWORD Location ) { - return FALSE; -} - -int NoOfBpoints; - - -#ifdef OLD_CODE -#if (!defined(EXTERNAL_RELEASE)) -#include - -#include -#include -#include "main.h" -#include "CPU.h" -#include "debugger.h" -#include "plugin.h" - -#define IDC_LIST 100 -#define IDC_TAB_CONTROL 101 -#define IDC_REMOVE_BUTTON 103 -#define IDC_REMOVEALL_BUTTON 104 -#define IDC_LOCATION_EDIT 105 -#define IDC_FUNCTION_COMBO 106 - -void BPoint_AddButtonPressed ( void); -void Create_BPoint_Window ( int ); -void DrawBPItem ( LPARAM ); -void HideBPointPanel ( int Panel); -void Paint_BPoint_Win ( HWND ); -void __cdecl RefreshBreakPoints (void); -void Setup_BPoint_Win ( HWND ); -void ShowBPointPanel ( int Panel); -LRESULT CALLBACK BPoint_Proc ( HWND, UINT, WPARAM, LPARAM ); -LRESULT CALLBACK RefreshBPProc ( HWND, UINT, WPARAM, LPARAM ); - -static HWND BPoint_Win_hDlg, hTab, hList, hStatic, hR4300iLocation, hFunctionlist, - hAddButton, hRemoveButton, hRemoveAllButton; -static BOOL InBPWindow = FALSE; -static FARPROC RefProc; -int RSPBP_count; - -int Add_R4300iBPoint( DWORD Location, int Confirm ) { - int count; - - if (NoOfBpoints == MaxBPoints) { - _Notify->DisplayError("Max amount of Break Points set"); - return FALSE; - } - - for (count = 0; count < NoOfBpoints; count ++) { - if (BPoint[count].Location == Location) { - _Notify->DisplayError("You already have this Break Point"); - return FALSE; - } - } - - if (Confirm) { - char Message[150], Label[100]; - int Response; - - sprintf(Label,"%s", LabelName(Location)); - sprintf(Message,"0x%08X", Location); - if(strcmp(Label,Message) == 0) { - sprintf(Message,"Break when:\n\nR4300i's Program Counter = 0x%08X\n\nIs this correct?", - Location); - } else { - sprintf(Message,"Break on:\n\n%s (R4300i PC = 0x%08X)\n\nIs this correct?", - Label, Location); - } - Response = MessageBox(BPoint_Win_hDlg, Message, AppName, MB_YESNO | MB_ICONINFORMATION); - if (Response == IDNO) { - return FALSE; - } - } - BPoint[NoOfBpoints].Location = Location; - NoOfBpoints += 1; - RefreshBreakPoints(); - /*if (CPU_Action.Stepping || hMipsCPU == NULL) { - ClearAllx86Code(); - } else { - CPU_Action.ResetX86Code = TRUE; - CPU_Action.do_or_check_something += 1; - }*/ - return TRUE; -} - -void BPoint_AddButtonPressed (void) { - DWORD Selected, Location; - char Title[10]; - TC_ITEM item; - - item.mask = TCIF_PARAM; - TabCtrl_GetItem( hTab, TabCtrl_GetCurSel( hTab ), &item ); - switch( item.lParam ) { - case R4300i_BP: - GetWindowText(hR4300iLocation,Title,sizeof(Title)); - if (!Add_R4300iBPoint(AsciiToHex(Title),TRUE )) { - SendMessage(hR4300iLocation,EM_SETSEL,(WPARAM)0,(LPARAM)-1); - SetFocus(hR4300iLocation); - } - break; - case R4300i_FUNCTION: - Selected = SendMessage(hFunctionlist,CB_GETCURSEL,0,0); - Location = SendMessage(hFunctionlist,CB_GETITEMDATA,(WPARAM)Selected,0); - Add_R4300iBPoint(Location,TRUE ); - SetFocus(hFunctionlist); - break; - case RSP_BP: - if (RspDebug.UseBPoints) { RspDebug.Add_BPoint(); } - break; - } - -} - -LRESULT CALLBACK BPoint_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - static RECT rcDisp; - static int CurrentPanel = R4300i_BP; - int selected; - TC_ITEM item; - - switch (uMsg) { - case WM_INITDIALOG: - BPoint_Win_hDlg = hDlg; - Setup_BPoint_Win( hDlg ); - RefreshBreakPoints(); - break; - case WM_MOVE: - StoreCurrentWinPos("Break Point",hDlg); - break; - case WM_SIZE: - GetClientRect( hDlg, &rcDisp); - TabCtrl_AdjustRect( hTab, FALSE, &rcDisp ); - break; - case WM_PAINT: - Paint_BPoint_Win( hDlg ); - return TRUE; - case WM_NOTIFY: - switch (((NMHDR *)lParam)->code) { - case TCN_SELCHANGE: - InvalidateRect( hTab, &rcDisp, TRUE ); - HideBPointPanel (CurrentPanel); - item.mask = TCIF_PARAM; - TabCtrl_GetItem( hTab, TabCtrl_GetCurSel( hTab ), &item ); - CurrentPanel = item.lParam; - InvalidateRect( hStatic, NULL, FALSE ); - ShowBPointPanel ( CurrentPanel ); - break; - } - break; - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDOK: - BPoint_AddButtonPressed(); - break; - case IDC_REMOVE_BUTTON: - selected = SendMessage(hList,LB_GETCURSEL,0,0); - if (selected < NoOfBpoints) { - DWORD location; - location = SendMessage(hList,LB_GETITEMDATA,selected,0); - RemoveR4300iBreakPoint(location); - break; - } - selected -= NoOfBpoints; - if (selected < RSPBP_count) { - RspDebug.RemoveBpoint(hList,SendMessage(hList,LB_GETCURSEL,0,0)); - break; - } - _Notify->DisplayError("what is this BP"); - break; - case IDC_REMOVEALL_BUTTON: - NoOfBpoints = 0; - if (RspDebug.UseBPoints) { RspDebug.RemoveAllBpoint(); } - RefreshBreakPoints(); - RefreshR4300iCommands(); - break; - case IDCANCEL: - CurrentPanel = R4300i_BP; - EndDialog( hDlg, IDCANCEL ); - break; - } - break; - default: - return FALSE; - } - return TRUE; -} - -int CheckForR4300iBPoint ( DWORD Location ) { - int count; - - for (count = 0; count < NoOfBpoints; count ++){ - if (BPoint[count].Location == Location) { - return TRUE; - } - } - return FALSE; -} - -void Create_BPoint_Window (int Child) { - DWORD ThreadID; - - if (Child) { - InBPWindow = TRUE; - DialogBox( hInst, "BLANK", NULL,(DLGPROC) BPoint_Proc ); - InBPWindow = FALSE; - } else { - if (!InBPWindow) { - CloseHandle(CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)Create_BPoint_Window, - (LPVOID)TRUE,0, &ThreadID)); - } else { - BringWindowToTop(BPoint_Win_hDlg); - } - } -} - -void __cdecl Enter_BPoint_Window ( void ) { - Create_BPoint_Window ( FALSE ); -} - -void HideBPointPanel ( int Panel) { - switch( Panel ) { - case R4300i_BP: ShowWindow(hR4300iLocation, FALSE); break; - case R4300i_FUNCTION: ShowWindow(hFunctionlist, FALSE); break; - case RSP_BP: if (RspDebug.UseBPoints) { RspDebug.HideBPPanel(); } break; - } -} - -void Paint_BPoint_Win (HWND hDlg) { - RECT rcBox; - PAINTSTRUCT ps; - HFONT hOldFont; - int OldBkMode; - - BeginPaint( hDlg, &ps ); - rcBox.left = 5; - rcBox.top = 175; - rcBox.right = 255; - rcBox.bottom = 290; - DrawEdge( ps.hdc, &rcBox, EDGE_RAISED, BF_RECT ); - rcBox.left = 8; - rcBox.top = 178; - rcBox.right = 252; - rcBox.bottom = 287; - DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT ); - - hOldFont = SelectObject(ps.hdc,GetStockObject(DEFAULT_GUI_FONT)); - OldBkMode = SetBkMode( ps.hdc, TRANSPARENT ); - - TextOut( ps.hdc, 9,159,"Breakpoints: ",13); - - SelectObject( ps.hdc,hOldFont ); - SetBkMode( ps.hdc, OldBkMode ); - - EndPaint( hDlg, &ps ); -} - -void __cdecl RefreshBreakPoints (void) { - char Message[100]; - int count; - - if (!InBPWindow) { return; } - - SendMessage(hList,LB_RESETCONTENT,0,0); - for (count = 0; count < NoOfBpoints; count ++ ) { - sprintf(Message," at 0x%08X (r4300i)", BPoint[count].Location); - SendMessage(hList,LB_ADDSTRING,0,(LPARAM)Message); - SendMessage(hList,LB_SETITEMDATA,count,(LPARAM)BPoint[count].Location); - } - count = SendMessage(hList,LB_GETCOUNT,0,0); - if (RspDebug.UseBPoints) { RspDebug.RefreshBpoints(hList); } - RSPBP_count = SendMessage(hList,LB_GETCOUNT,0,0) - count; - - if (SendMessage(hList,LB_GETCOUNT,0,0) > 0) { - EnableWindow( hRemoveButton, TRUE ); - EnableWindow( hRemoveAllButton, TRUE ); - } -} - -LRESULT CALLBACK RefreshBPProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { - PAINTSTRUCT ps; - RECT rcBox; - HFONT hOldFont; - int OldBkMode; - TC_ITEM item; - - switch( uMsg ) { - case WM_PAINT: - BeginPaint( hWnd, &ps ); - rcBox.left = 15; - rcBox.top = 40; - rcBox.right = 235; - rcBox.bottom = 125; - DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT ); - - hOldFont = SelectObject( ps.hdc, - GetStockObject(DEFAULT_GUI_FONT) ); - OldBkMode = SetBkMode( ps.hdc, TRANSPARENT ); - - item.mask = TCIF_PARAM; - TabCtrl_GetItem( hTab, TabCtrl_GetCurSel( hTab ), &item ); - switch (item.lParam) { - case R4300i_BP: - TextOut( ps.hdc, 29,60,"Break when the Program Counter equals",37); - TextOut( ps.hdc, 59,85,"0x",2); - break; - case R4300i_FUNCTION: - TextOut( ps.hdc, 75,60,"Break on label:",15); - break; - case RSP_BP: - if (RspDebug.UseBPoints) { RspDebug.PaintBPPanel(ps); } - break; - } - - SelectObject( ps.hdc,hOldFont ); - SetBkMode( ps.hdc, OldBkMode ); - - EndPaint( hWnd, &ps ); - break; - default: - return( (*RefProc)(hWnd, uMsg, wParam, lParam) ); - } - return( FALSE ); -} - -void RemoveR4300iBreakPoint (DWORD Location) { - int count, location = -1; - - for (count = 0; count < NoOfBpoints; count ++){ - if (BPoint[count].Location == Location) { - location = count; - count = NoOfBpoints; - } - } - - if (location >= 0) { - for (count = location; count < NoOfBpoints - 1; count ++ ){ - BPoint[count].Location = BPoint[count + 1].Location; - } - NoOfBpoints -= 1; - RefreshBreakPoints (); - } - - /*if (CPU_Action.Stepping || hMipsCPU == NULL) { - ClearAllx86Code(); - } else { - CPU_Action.ResetX86Code = TRUE; - CPU_Action.do_or_check_something += 1; - }*/ -} - -void Setup_BPoint_Win (HWND hDlg) { -#define WindowWidth 350 -#define WindowHeight 320 - DWORD X, Y; - - hAddButton = CreateWindowEx(0,"BUTTON","&Add", - BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, - 262,26,75,22,hDlg,(HMENU)IDOK, - hInst,NULL ); - if ( hAddButton ) { - SendMessage(hAddButton,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } - - hRemoveButton = CreateWindowEx(0,"BUTTON","&Remove", - WS_CHILD | BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | - WS_DISABLED,262,177,75,22,hDlg,(HMENU)IDC_REMOVE_BUTTON, - hInst,NULL ); - if ( hRemoveButton ) { - SendMessage(hRemoveButton,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } - - hRemoveAllButton = CreateWindowEx(0,"BUTTON","Remove A&ll", WS_CHILD | - BS_PUSHBUTTON | WS_VISIBLE | WS_TABSTOP | WS_DISABLED,262,202,75,22,hDlg, - (HMENU)IDC_REMOVEALL_BUTTON,hInst,NULL ); - if ( hRemoveAllButton ) { - SendMessage(hRemoveAllButton,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } - - hTab = CreateWindowEx(0,WC_TABCONTROL,"", WS_CHILD | WS_TABSTOP | WS_VISIBLE, - 5,6,250,150,hDlg,(HMENU)IDC_TAB_CONTROL,hInst,NULL ); - if (hTab) { - TC_ITEM item; - - SendMessage(hTab, WM_SETFONT, (WPARAM)GetStockObject( DEFAULT_GUI_FONT ), 0 ); - item.mask = TCIF_TEXT | TCIF_PARAM; - item.pszText = " R4300i "; - item.lParam = R4300i_BP; - TabCtrl_InsertItem( hTab,0, &item); - if (NoOfMapEntries != 0) { - item.mask = TCIF_TEXT | TCIF_PARAM; - item.pszText = " Function "; - item.lParam = R4300i_FUNCTION; - TabCtrl_InsertItem( hTab,1, &item); - } - if (RspDebug.UseBPoints) { - RECT rcBox; - rcBox.left = 15; rcBox.top = 40; - rcBox.right = 235; rcBox.bottom = 125; - item.mask = TCIF_TEXT | TCIF_PARAM; - item.pszText = RspDebug.BPPanelName; - item.lParam = RSP_BP; - TabCtrl_InsertItem( hTab,2, &item); - RspDebug.CreateBPPanel(hDlg,rcBox); - } - } - - hR4300iLocation = CreateWindowEx(0,"EDIT","", WS_CHILD | WS_VISIBLE | WS_BORDER | - ES_UPPERCASE | WS_TABSTOP,83,90,100,17,hDlg,(HMENU)IDC_LOCATION_EDIT,hInst,NULL); - if (hR4300iLocation) { - char Title[20]; - SendMessage(hR4300iLocation,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - SendMessage(hR4300iLocation,EM_SETLIMITTEXT,(WPARAM)8,(LPARAM)0); - sprintf(Title,"%08X",PROGRAM_COUNTER); - SetWindowText(hR4300iLocation,Title); - } - - hFunctionlist = CreateWindowEx(0,"COMBOBOX","", WS_CHILD | WS_VSCROLL | - CBS_DROPDOWNLIST | CBS_SORT | WS_TABSTOP,55,90,150,150,hDlg, - (HMENU)IDC_FUNCTION_COMBO,hInst,NULL); - if (hFunctionlist) { - DWORD count, pos; - - SendMessage(hFunctionlist,WM_SETFONT,(WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - for (count = 0; count < NoOfMapEntries; count ++ ) { - pos = SendMessage(hFunctionlist,CB_ADDSTRING,(WPARAM)0,(LPARAM)MapTable[count].Label); - SendMessage(hFunctionlist,CB_SETITEMDATA,(WPARAM)pos,(LPARAM)MapTable[count].VAddr); - } - SendMessage(hFunctionlist,CB_SETCURSEL,(WPARAM)1,(LPARAM)0); - } - - hList = CreateWindowEx(WS_EX_STATICEDGE, "LISTBOX","", WS_CHILD | WS_VISIBLE | LBS_DISABLENOSCROLL |WS_VSCROLL, - 16,187,228,112, hDlg, (HMENU)IDC_LIST, hInst,NULL ); - if ( hList) { - SendMessage(hList,WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } - - hStatic = CreateWindowEx(0,"STATIC","", WS_CHILD | WS_VISIBLE, 5,6,250,150,hDlg,0,hInst,NULL ); - RefProc = (FARPROC)SetWindowLong( hStatic,GWL_WNDPROC,(long)RefreshBPProc); - - SetWindowText(hDlg," Breakpoints"); - - if ( !GetStoredWinPos( "Break Point", &X, &Y ) ) { - X = (GetSystemMetrics( SM_CXSCREEN ) - WindowWidth) / 2; - Y = (GetSystemMetrics( SM_CYSCREEN ) - WindowHeight) / 2; - } - SetWindowPos(hDlg,NULL,X,Y,WindowWidth,WindowHeight, SWP_NOZORDER | SWP_SHOWWINDOW); -} - -void ShowBPointPanel ( int Panel) { - switch( Panel ) { - case R4300i_BP: ShowWindow(hR4300iLocation, TRUE); break; - case R4300i_FUNCTION: ShowWindow(hFunctionlist, TRUE); break; - case RSP_BP: if (RspDebug.UseBPoints) { RspDebug.ShowBPPanel(); } break; - } -} - -void UpdateBPointGUI (void) { - TC_ITEM item; - DWORD count; - - if (!InBPWindow) { return; } - - if (TabCtrl_GetCurSel(hTab) != 0) { - InvalidateRect( hTab, NULL, TRUE ); - item.mask = TCIF_PARAM; - TabCtrl_GetItem( hTab, TabCtrl_GetCurSel( hTab ), &item ); - HideBPointPanel (item.lParam); - TabCtrl_SetCurSel(hTab, 0); - TabCtrl_GetItem( hTab, TabCtrl_GetCurSel( hTab ), &item ); - InvalidateRect( hStatic, NULL, FALSE ); - ShowBPointPanel ( item.lParam ); - } - - for (count = TabCtrl_GetItemCount(hTab); count > 1; count--) { - TabCtrl_DeleteItem(hTab, count - 1); - } - - if (NoOfMapEntries > 0) { - item.mask = TCIF_TEXT | TCIF_PARAM; - item.pszText = " Function "; - item.lParam = R4300i_FUNCTION; - TabCtrl_InsertItem( hTab,1, &item); - } - if (RspDebug.UseBPoints) { - RECT rcBox; - rcBox.left = 15; rcBox.top = 40; - rcBox.right = 235; rcBox.bottom = 125; - item.mask = TCIF_TEXT | TCIF_PARAM; - item.pszText = RspDebug.BPPanelName; - item.lParam = RSP_BP; - TabCtrl_InsertItem( hTab,2, &item); - RspDebug.CreateBPPanel(BPoint_Win_hDlg, rcBox); - } - InvalidateRect( BPoint_Win_hDlg, NULL, TRUE ); - RefreshBreakPoints (); -} - -void UpdateBP_FunctionList (void) { - DWORD pos, count; - - if (!InBPWindow) { return; } - - SendMessage(hFunctionlist,CB_RESETCONTENT,(WPARAM)0,(LPARAM)0); - for (count = 0; count < NoOfMapEntries; count ++ ) { - pos = SendMessage(hFunctionlist,CB_ADDSTRING,(WPARAM)0,(LPARAM)MapTable[count].Label); - SendMessage(hFunctionlist,CB_SETITEMDATA,(WPARAM)pos,(LPARAM)MapTable[count].VAddr); - } - SendMessage(hFunctionlist,CB_SETCURSEL,(WPARAM)1,(LPARAM)0); - UpdateBPointGUI(); -} -#endif -#endif - -#endif \ No newline at end of file diff --git a/Source/Project64/N64 System/C Core/BreakPoints.h b/Source/Project64/N64 System/C Core/BreakPoints.h deleted file mode 100644 index 1c33dce25..000000000 --- a/Source/Project64/N64 System/C Core/BreakPoints.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Project 64 - A Nintendo 64 emulator. - * - * (c) Copyright 2001 zilmar (zilmar@emulation64.com) and - * Jabo (jabo@emulation64.com). - * - * pj64 homepage: www.pj64.net - * - * Permission to use, copy, modify and distribute Project64 in both binary and - * source form, for non-commercial purposes, is hereby granted without fee, - * providing that this license information and copyright notice appear with - * all copies and any derived work. - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event shall the authors be held liable for any damages - * arising from the use of this software. - * - * Project64 is freeware for PERSONAL USE only. Commercial users should - * seek permission of the copyright holders first. Commercial use includes - * charging money for Project64 or software derived from Project64. - * - * The copyright holders request that bug fixes and improvements to the code - * should be forwarded to them so if they want them. - * - */ -#ifndef __breakpoints_h -#define __breakpoints_h - -void __cdecl Enter_BPoint_Window ( void ); -int Add_R4300iBPoint ( DWORD Location, int Confirm ); -int CheckForR4300iBPoint ( DWORD Location ); -void __cdecl RefreshBreakPoints ( void ); -void RemoveR4300iBreakPoint ( DWORD Location ); -void UpdateBPointGUI ( void ); -void UpdateBP_FunctionList ( void ); - -#define MaxBPoints 0x100 -#define R4300i_BP 1 -#define R4300i_FUNCTION 2 -#define RSP_BP 3 - -typedef struct { - unsigned int Location; -} BPOINT; - -extern BPOINT BPoint[MaxBPoints]; -extern int NoOfBpoints; - -#endif diff --git a/Source/Project64/N64 System/C Core/C main.cpp b/Source/Project64/N64 System/C Core/C main.cpp deleted file mode 100644 index 981a12954..000000000 --- a/Source/Project64/N64 System/C Core/C main.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "stdafx.h" - -int GetStoredWinPos( char * WinName, DWORD * X, DWORD * Y ) { - long lResult; - HKEY hKeyResults = 0; - char String[200]; - - sprintf(String,"Software\\N64 Emulation\\%s\\Page Setup",_Settings->LoadString(Setting_ApplicationName)); - lResult = RegOpenKeyEx( HKEY_CURRENT_USER,String,0, KEY_ALL_ACCESS,&hKeyResults); - - if (lResult == ERROR_SUCCESS) { - DWORD Type, Value, Bytes = 4; - - sprintf(String,"%s Top",WinName); - lResult = RegQueryValueEx(hKeyResults,String,0,&Type,(LPBYTE)(&Value),&Bytes); - if (Type == REG_DWORD && lResult == ERROR_SUCCESS) { - *Y = Value; - } else { - RegCloseKey(hKeyResults); - return FALSE; - } - - sprintf(String,"%s Left",WinName); - lResult = RegQueryValueEx(hKeyResults,String,0,&Type,(LPBYTE)(&Value),&Bytes); - if (Type == REG_DWORD && lResult == ERROR_SUCCESS) { - *X = Value; - } else { - RegCloseKey(hKeyResults); - return FALSE; - } - RegCloseKey(hKeyResults); - return TRUE; - } - return FALSE; -} - -void StoreCurrentWinPos ( char * WinName, HWND hWnd ) { - long lResult; - HKEY hKeyResults = 0; - DWORD Disposition = 0; - RECT WinRect; - char String[200]; - - GetWindowRect(hWnd, &WinRect ); - sprintf(String,"Software\\N64 Emulation\\%s\\Page Setup",_Settings->LoadString(Setting_ApplicationName)); - lResult = RegCreateKeyEx( HKEY_CURRENT_USER, String,0,"", REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS,NULL, &hKeyResults,&Disposition); - if (lResult == ERROR_SUCCESS) { - sprintf(String,"%s Top",WinName); - RegSetValueEx(hKeyResults,String,0, REG_DWORD,(CONST BYTE *)(&WinRect.top), - sizeof(DWORD)); - sprintf(String,"%s Left",WinName); - RegSetValueEx(hKeyResults,String,0, REG_DWORD,(CONST BYTE *)(&WinRect.left), - sizeof(DWORD)); - } - RegCloseKey(hKeyResults); -} diff --git a/Source/Project64/N64 System/C Core/r4300i Registers.cpp b/Source/Project64/N64 System/C Core/r4300i Registers.cpp deleted file mode 100644 index 1bf319889..000000000 --- a/Source/Project64/N64 System/C Core/r4300i Registers.cpp +++ /dev/null @@ -1,1208 +0,0 @@ -#include "stdafx.h" - -/* - * Project 64 - A Nintendo 64 emulator. - * - * (c) Copyright 2001 zilmar (zilmar@emulation64.com) and - * Jabo (jabo@emulation64.com). - * - * pj64 homepage: www.pj64.net - * - * Permission to use, copy, modify and distribute Project64 in both binary and - * source form, for non-commercial purposes, is hereby granted without fee, - * providing that this license information and copyright notice appear with - * all copies and any derived work. - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event shall the authors be held liable for any damages - * arising from the use of this software. - * - * Project64 is freeware for PERSONAL USE only. Commercial users should - * seek permission of the copyright holders first. Commercial use includes - * charging money for Project64 or software derived from Project64. - * - * The copyright holders request that bug fixes and improvements to the code - * should be forwarded to them so if they want them. - * - */ - -void __cdecl UpdateCurrentR4300iRegisterPanel ( void ) { -} - -#ifdef OLD_CODE -#if (!defined(EXTERNAL_RELEASE)) -#include -#include -#include -#include "main.h" -#include "CPU.h" -#include "r4300i Registers.h" - -#define GeneralPurpose 1 -#define ControlProcessor0 2 -#define FloatingRegisters 3 -#define SpecialRegister 4 -#define RDRAMRegisters 5 -#define SPRegisters 6 -#define MIPSInterface 7 -#define VideoInterface 8 -#define AudioInterface 9 -#define PeripheralInterface 10 -#define RDRAMInterface 11 -#define SerialInterface 12 - -#define IDC_TAB_CONTROL 1000 - -void Create_R4300i_Register_Window ( int ); -void PaintR4300iAIPanel ( HWND ); -void PaintR4300iCP0Panel ( HWND ); -void PaintR4300iFPRPanel ( HWND ); -void PaintR4300iGPRPanel ( HWND ); -void PaintR4300iMIPanel ( HWND ); -void PaintR4300iRDRamPanel ( HWND ); -void PaintR4300iPIPanel ( HWND ); -void PaintR4300iRIPanel ( HWND );/* - * Project 64 - A Nintendo 64 emulator. - * - * (c) Copyright 2001 zilmar (zilmar@emulation64.com) and - * Jabo (jabo@emulation64.com). - * - * pj64 homepage: www.pj64.net - * - * Permission to use, copy, modify and distribute Project64 in both binary and - * source form, for non-commercial purposes, is hereby granted without fee, - * providing that this license information and copyright notice appear with - * all copies and any derived work. - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event shall the authors be held liable for any damages - * arising from the use of this software. - * - * Project64 is freeware for PERSONAL USE only. Commercial users should - * seek permission of the copyright holders first. Commercial use includes - * charging money for Project64 or software derived from Project64. - * - * The copyright holders request that bug fixes and improvements to the code - * should be forwarded to them so if they want them. - * -*/ - -void PaintR4300iSIPanel ( HWND ); -void PaintR4300iSPPanel ( HWND ); -void PaintR4300iSpecialPanel ( HWND ); -void PaintR4300iMIPanel ( HWND ); -void PaintR4300iVIPanel ( HWND ); -void PaintR4300iRIPanel ( HWND ); - -void SetupR4300iAIPanel ( HWND ); -void SetupR4300iCP0Panel ( HWND ); -void SetupR4300iFPRPanel ( HWND ); -void SetupR4300iGPRPanel ( HWND ); -void SetupR4300iMIPanel ( HWND ); -void SetupR4300iRDRamPanel ( HWND ); -void SetupR4300iPIPanel ( HWND ); -void SetupR4300iRIPanel ( HWND ); -void SetupR4300iSIPanel ( HWND ); -void SetupR4300iSPPanel ( HWND ); -void SetupR4300iSpecialPanel ( HWND ); -void SetupR4300iVIPanel ( HWND ); -void SetupR4300iRegistersMain ( HWND ); -void ShowR4300iRegisterPanel ( int ); - -LRESULT CALLBACK RefreshR4300iRegProc ( HWND, UINT, WPARAM, LPARAM ); -LRESULT CALLBACK R4300i_Registers_Proc ( HWND, UINT, WPARAM, LPARAM ); - -HWND R4300i_Registers_hDlg, hTab, hStatic, hGPR[32], hCP0[32], hFPR[32], hSpecial[6], - hRDRam[10], hSP[10], hMI[4], hVI[14], hAI[6], hPI[13], hRI[8], hSI[4]; -int InR4300iRegisterWindow = FALSE; -FARPROC r4300iRegRefreshProc; - -void Create_R4300i_Register_Window ( int Child ) { - DWORD ThreadID; - - if ( Child ) { - InR4300iRegisterWindow = TRUE; - DialogBox( hInst, "BLANK", NULL,(DLGPROC) R4300i_Registers_Proc ); - InR4300iRegisterWindow = FALSE; - } else { - if (!InR4300iRegisterWindow) { - CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)Create_R4300i_Register_Window, - (LPVOID)TRUE,0, &ThreadID); - } else { - SetForegroundWindow(R4300i_Registers_hDlg); - } - } -} - -void __cdecl Enter_R4300i_Register_Window ( void ) { - if (!HaveDebugger) { return; } - Create_R4300i_Register_Window ( FALSE ); -} - -void HideR4300iRegisterPanel ( int Panel) { - int count; - - switch( Panel ) { - case GeneralPurpose: - for (count = 0; count < 32;count ++) { ShowWindow(hGPR[count],FALSE); } - break; - case ControlProcessor0: - for (count = 0; count < 32;count ++) { ShowWindow(hCP0[count],FALSE); } - break; - case FloatingRegisters: - for (count = 0; count < 32;count ++) { ShowWindow(hFPR[count],FALSE); } - break; - case SpecialRegister: - for (count = 0; count < 6;count ++) { ShowWindow(hSpecial[count],FALSE); } - break; - case RDRAMRegisters: - for (count = 0; count < 10;count ++) { ShowWindow(hRDRam[count],FALSE); } - break; - case SPRegisters: - for (count = 0; count < 10;count ++) { ShowWindow(hSP[count],FALSE); } - break; - case MIPSInterface: - for (count = 0; count < 4;count ++) { ShowWindow(hMI[count],FALSE); } - break; - case VideoInterface: - for (count = 0; count < 14;count ++) { ShowWindow(hVI[count],FALSE); } - break; - case AudioInterface: - for (count = 0; count < 6;count ++) { ShowWindow(hAI[count],FALSE); } - break; - case PeripheralInterface: - for (count = 0; count < 13;count ++) { ShowWindow(hPI[count],FALSE); } - break; - case RDRAMInterface: - for (count = 0; count < 13;count ++) { ShowWindow(hRI[count],FALSE); } - break; - case SerialInterface: - for (count = 0; count < 4;count ++) { ShowWindow(hSI[count],FALSE); } - break; - } -} - -void PaintR4300iAIPanel (HWND hWnd) { - PAINTSTRUCT ps; - RECT rcBox; - HFONT hOldFont; - int OldBkMode; - BeginPaint( hWnd, &ps ); - - rcBox.left = 184; - rcBox.top = 44; - rcBox.right = 450; - rcBox.bottom = 250; - DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT ); - - hOldFont = SelectObject( ps.hdc, - GetStockObject(DEFAULT_GUI_FONT) ); - OldBkMode = SetBkMode( ps.hdc, TRANSPARENT ); - - TextOut( ps.hdc, 207,66,"AI_DRAM_ADDR_REG:",17); - TextOut( ps.hdc, 207,96,"AI_LEN_REG:",11); - TextOut( ps.hdc, 207,126,"AI_CONTROL_REG:",15); - TextOut( ps.hdc, 207,156,"AI_STATUS_REG:",14); - TextOut( ps.hdc, 207,186,"AI_DACRATE_REG:",15); - TextOut( ps.hdc, 207,216,"AI_BITRATE_REG:",15); - - SelectObject( ps.hdc,hOldFont ); - SetBkMode( ps.hdc, OldBkMode ); - EndPaint( hWnd, &ps ); -} - -void PaintR4300iCP0Panel (HWND hWnd) { - PAINTSTRUCT ps; - RECT rcBox; - HFONT hOldFont; - int OldBkMode; - BeginPaint( hWnd, &ps ); - - rcBox.left = 10; - rcBox.top = 34; - rcBox.right = 650; - rcBox.bottom = 270; - DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT ); - - hOldFont = SelectObject( ps.hdc, - GetStockObject(DEFAULT_GUI_FONT) ); - OldBkMode = SetBkMode( ps.hdc, TRANSPARENT ); - - TextOut( ps.hdc, 55,49,"Index:",6); - TextOut( ps.hdc, 55,73,"Random:",7); - TextOut( ps.hdc, 55,97,"EntryLo0:",9); - TextOut( ps.hdc, 55,121,"EntryLo1:",9); - TextOut( ps.hdc, 55,145,"Context:",8); - TextOut( ps.hdc, 55,169,"PageMask:",9); - TextOut( ps.hdc, 55,193,"Wired:",6); - TextOut( ps.hdc, 55,217,"BadVaddr:",9); - TextOut( ps.hdc, 55,241,"Count:",6); - TextOut( ps.hdc, 260,49,"EntryHi:",8); - TextOut( ps.hdc, 260,73,"Compare:",8); - TextOut( ps.hdc, 260,97,"Status:",7); - TextOut( ps.hdc, 260,121,"Cause:",6); - TextOut( ps.hdc, 260,145,"EPC:",4); - TextOut( ps.hdc, 260,169,"PRId:",5); - TextOut( ps.hdc, 260,193,"Config:",7); - TextOut( ps.hdc, 260,217,"LLAddr:",7); - TextOut( ps.hdc, 455,49,"WatchLo:",8); - TextOut( ps.hdc, 455,73,"WatchHi:",8); - TextOut( ps.hdc, 455,97,"XContext:",9); - TextOut( ps.hdc, 455,121,"Parity Error:",13); - TextOut( ps.hdc, 455,145,"Cache Error:",12); - TextOut( ps.hdc, 455,169,"TagLo:",6); - TextOut( ps.hdc, 455,193,"TagHi:",6); - TextOut( ps.hdc, 455,217,"ErrorEPC:",9); - - SelectObject( ps.hdc,hOldFont ); - SetBkMode( ps.hdc, OldBkMode ); - - EndPaint( hWnd, &ps ); -} - -void PaintR4300iFPRPanel (HWND hWnd) { - PAINTSTRUCT ps; - RECT rcBox; - HFONT hOldFont; - int OldBkMode; - BeginPaint( hWnd, &ps ); - - rcBox.left = 10; - rcBox.top = 29; - rcBox.right = 650; - rcBox.bottom = 275; - DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT ); - - hOldFont = SelectObject( ps.hdc, - GetStockObject(DEFAULT_GUI_FONT) ); - OldBkMode = SetBkMode( ps.hdc, TRANSPARENT ); - - TextOut( ps.hdc, 25,46," Reg 0:",7); - TextOut( ps.hdc, 25,66," Reg 1:",7); - TextOut( ps.hdc, 25,86," Reg 2:",7); - TextOut( ps.hdc, 25,106," Reg 3:",7); - TextOut( ps.hdc, 25,126," Reg 4:",7); - TextOut( ps.hdc, 25,146," Reg 5:",7); - TextOut( ps.hdc, 25,166," Reg 6:",7); - TextOut( ps.hdc, 25,186," Reg 7:",7); - TextOut( ps.hdc, 25,206," Reg 8:",7); - TextOut( ps.hdc, 25,226," Reg 9:",7); - TextOut( ps.hdc, 25,246,"Reg 10:",7); - TextOut( ps.hdc, 240,46,"Reg 11:",7); - TextOut( ps.hdc, 240,66,"Reg 12:",7); - TextOut( ps.hdc, 240,86,"Reg 13:",7); - TextOut( ps.hdc, 240,106,"Reg 14:",7); - TextOut( ps.hdc, 240,126,"Reg 15:",7); - TextOut( ps.hdc, 240,146,"Reg 16:",7); - TextOut( ps.hdc, 240,166,"Reg 17:",7); - TextOut( ps.hdc, 240,186,"Reg 18:",7); - TextOut( ps.hdc, 240,206,"Reg 19:",7); - TextOut( ps.hdc, 240,226,"Reg 20:",7); - TextOut( ps.hdc, 240,246,"Reg 21:",7); - TextOut( ps.hdc, 450,46,"Reg 22:",7); - TextOut( ps.hdc, 450,66,"Reg 23:",7); - TextOut( ps.hdc, 450,86,"Reg 24:",7); - TextOut( ps.hdc, 450,106,"Reg 25:",7); - TextOut( ps.hdc, 450,126,"Reg 26:",7); - TextOut( ps.hdc, 450,146,"Reg 27:",7); - TextOut( ps.hdc, 450,166,"Reg 28:",7); - TextOut( ps.hdc, 450,186,"Reg 29:",7); - TextOut( ps.hdc, 450,206,"Reg 30:",7); - TextOut( ps.hdc, 450,226,"Reg 31:",7); - - SelectObject( ps.hdc,hOldFont ); - SetBkMode( ps.hdc, OldBkMode ); - EndPaint( hWnd, &ps ); -} - -void PaintR4300iGPRPanel (HWND hWnd) { - PAINTSTRUCT ps; - RECT rcBox; - HFONT hOldFont; - int OldBkMode; - BeginPaint( hWnd, &ps ); - - rcBox.left = 10; - rcBox.top = 29; - rcBox.right = 650; - rcBox.bottom = 275; - DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT ); - - hOldFont = SelectObject( ps.hdc, - GetStockObject(DEFAULT_GUI_FONT) ); - OldBkMode = SetBkMode( ps.hdc, TRANSPARENT ); - - TextOut( ps.hdc, 20,46,"R0 - Reg 0:",11); - TextOut( ps.hdc, 20,66,"AT - Reg 1:",11); - TextOut( ps.hdc, 20,86,"V0 - Reg 2:",11); - TextOut( ps.hdc, 20,106,"V1 - Reg 3:",11); - TextOut( ps.hdc, 20,126,"A0 - Reg 4:",11); - TextOut( ps.hdc, 20,146,"A1 - Reg 5:",11); - TextOut( ps.hdc, 20,166,"A2 - Reg 6:",11); - TextOut( ps.hdc, 20,186,"A3 - Reg 7:",11); - TextOut( ps.hdc, 20,206,"T0 - Reg 8:",11); - TextOut( ps.hdc, 20,226,"T1 - Reg 9:",11); - TextOut( ps.hdc, 20,246,"T2 - Reg 10:",12); - TextOut( ps.hdc, 225,46,"T3 - Reg 11:",12); - TextOut( ps.hdc, 225,66,"T4 - Reg 12:",12); - TextOut( ps.hdc, 225,86,"T5 - Reg 13:",12); - TextOut( ps.hdc, 225,106,"T6 - Reg 14:",12); - TextOut( ps.hdc, 225,126,"T7 - Reg 15:",12); - TextOut( ps.hdc, 225,146,"S0 - Reg 16:",12); - TextOut( ps.hdc, 225,166,"S1 - Reg 17:",12); - TextOut( ps.hdc, 225,186,"S2 - Reg 18:",12); - TextOut( ps.hdc, 225,206,"S3 - Reg 19:",12); - TextOut( ps.hdc, 225,226,"S4 - Reg 20:",12); - TextOut( ps.hdc, 225,246,"S5 - Reg 21:",12); - TextOut( ps.hdc, 435,46,"S6 - Reg 22:",12); - TextOut( ps.hdc, 435,66,"S7 - Reg 23:",12); - TextOut( ps.hdc, 435,86,"T8 - Reg 24:",12); - TextOut( ps.hdc, 435,106,"T9 - Reg 25:",12); - TextOut( ps.hdc, 435,126,"K0 - Reg 26:",12); - TextOut( ps.hdc, 435,146,"K1 - Reg 27:",12); - TextOut( ps.hdc, 435,166,"GP - Reg 28:",12); - TextOut( ps.hdc, 435,186,"SP - Reg 29:",12); - TextOut( ps.hdc, 435,206,"S8 - Reg 30:",12); - TextOut( ps.hdc, 435,226,"RA - Reg 31:",12); - - SelectObject( ps.hdc,hOldFont ); - SetBkMode( ps.hdc, OldBkMode ); - EndPaint( hWnd, &ps ); -} - -void PaintR4300iRDRamPanel (HWND hWnd) { - PAINTSTRUCT ps; - RECT rcBox; - HFONT hOldFont; - int OldBkMode; - BeginPaint( hWnd, &ps ); - - rcBox.left = 155; - rcBox.top = 34; - rcBox.right = 495; - rcBox.bottom = 270; - DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT ); - - hOldFont = SelectObject( ps.hdc, - GetStockObject(DEFAULT_GUI_FONT) ); - OldBkMode = SetBkMode( ps.hdc, TRANSPARENT ); - - TextOut( ps.hdc, 190,56,"RDRAM_CONFIG_REG:",17); - TextOut( ps.hdc, 190,76,"RDRAM_DEVICE_ID_REG:",20); - TextOut( ps.hdc, 190,96,"RDRAM_DELAY_REG:",16); - TextOut( ps.hdc, 190,116,"RDRAM_MODE_REG:",15); - TextOut( ps.hdc, 190,136,"RDRAM_REF_INTERVAL_REG:",23); - TextOut( ps.hdc, 190,156,"RDRAM_REF_ROW_REG:",18); - TextOut( ps.hdc, 190,176,"RDRAM_RAS_INTERVAL_REG:",23); - TextOut( ps.hdc, 190,196,"RDRAM_MIN_INTERVAL_REG:",23); - TextOut( ps.hdc, 190,216,"RDRAM_ADDR_SELECT_REG:",22); - TextOut( ps.hdc, 190,236,"RDRAM_DEVICE_MANUF_REG:",23); - - SelectObject( ps.hdc,hOldFont ); - SetBkMode( ps.hdc, OldBkMode ); - EndPaint( hWnd, &ps ); -} - -void PaintR4300iRIPanel (HWND hWnd) { - PAINTSTRUCT ps; - RECT rcBox; - HFONT hOldFont; - int OldBkMode; - BeginPaint( hWnd, &ps ); - - rcBox.left = 95; - rcBox.top = 64; - rcBox.right = 565; - rcBox.bottom = 215; - DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT ); - - hOldFont = SelectObject( ps.hdc, - GetStockObject(DEFAULT_GUI_FONT) ); - OldBkMode = SetBkMode( ps.hdc, TRANSPARENT ); - - TextOut( ps.hdc, 110,86,"RI_MODE_REG:",12); - TextOut( ps.hdc, 110,116,"RI_CONFIG_REG:",14); - TextOut( ps.hdc, 110,146,"RI_CURRENT_LOAD_REG:",20); - TextOut( ps.hdc, 110,176,"RI_SELECT_REG:",14); - TextOut( ps.hdc, 360,86,"RI_REFRESH_REG:",15); - TextOut( ps.hdc, 360,116,"RI_LATENCY_REG:",15); - TextOut( ps.hdc, 360,146,"RI_RERROR_REG:",14); - TextOut( ps.hdc, 360,176,"RI_WERROR_REG:",14); - - SelectObject( ps.hdc,hOldFont ); - SetBkMode( ps.hdc, OldBkMode ); - EndPaint( hWnd, &ps ); -} - -void PaintR4300iSIPanel (HWND hWnd) { - PAINTSTRUCT ps; - RECT rcBox; - HFONT hOldFont; - int OldBkMode; - BeginPaint( hWnd, &ps ); - - rcBox.left = 175; - rcBox.top = 64; - rcBox.right = 475; - rcBox.bottom = 210; - DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT ); - - hOldFont = SelectObject( ps.hdc, - GetStockObject(DEFAULT_GUI_FONT) ); - OldBkMode = SetBkMode( ps.hdc, TRANSPARENT ); - - TextOut( ps.hdc, 200,86,"SI_DRAM_ADDR_REG:",17); - TextOut( ps.hdc, 200,116,"SI_PIF_ADDR_RD64B_REG:",22); - TextOut( ps.hdc, 200,146,"SI_PIF_ADDR_WR64B_REG:",22); - TextOut( ps.hdc, 200,176,"SI_STATUS_REG:",14); - - SelectObject( ps.hdc,hOldFont ); - SetBkMode( ps.hdc, OldBkMode ); - EndPaint( hWnd, &ps ); -} - -void PaintR4300iSPPanel (HWND hWnd) { - PAINTSTRUCT ps; - RECT rcBox; - HFONT hOldFont; - int OldBkMode; - BeginPaint( hWnd, &ps ); - - rcBox.left = 95; - rcBox.top = 64; - rcBox.right = 565; - rcBox.bottom = 232; - DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT ); - - hOldFont = SelectObject( ps.hdc, - GetStockObject(DEFAULT_GUI_FONT) ); - OldBkMode = SetBkMode( ps.hdc, TRANSPARENT ); - - TextOut( ps.hdc, 110,81,"SP_MEM_ADDR_REG:",16); - TextOut( ps.hdc, 110,111,"SP_DRAM_ADDR_REG:",17); - TextOut( ps.hdc, 110,141,"SP_RD_LEN_REG:",14); - TextOut( ps.hdc, 110,171,"SP_WR_LEN_REG:",14); - TextOut( ps.hdc, 110,201,"SP_STATUS_REG:",14); - TextOut( ps.hdc, 340,81,"SP_DMA_FULL_REG:",16); - TextOut( ps.hdc, 340,111,"SP_DMA_BUSY_REG:",16); - TextOut( ps.hdc, 340,141,"SP_SEMAPHORE_REG:",17); - TextOut( ps.hdc, 340,171,"SP_PC_REG:",10); - TextOut( ps.hdc, 340,201,"SP_IBIST_REG:",13); - - SelectObject( ps.hdc,hOldFont ); - SetBkMode( ps.hdc, OldBkMode ); - EndPaint( hWnd, &ps ); -} - -void PaintR4300iSpecialPanel (HWND hWnd) { - PAINTSTRUCT ps; - RECT rcBox; - HFONT hOldFont; - int OldBkMode; - BeginPaint( hWnd, &ps ); - - rcBox.left = 155; - rcBox.top = 34; - rcBox.right = 495; - rcBox.bottom = 270; - DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT ); - - hOldFont = SelectObject( ps.hdc, - GetStockObject(DEFAULT_GUI_FONT) ); - OldBkMode = SetBkMode( ps.hdc, TRANSPARENT ); - - TextOut( ps.hdc, 210,66,"Program Counter:",16); - TextOut( ps.hdc, 210,96,"Multi/Divide HI:",16); - TextOut( ps.hdc, 210,126,"Multi/Divide LO:",16); - TextOut( ps.hdc, 210,156,"Load/Link Bit:",14); - TextOut( ps.hdc, 210,186,"Implementation/Revision:",24); - TextOut( ps.hdc, 210,216,"Control/Status:",15); - - SelectObject( ps.hdc,hOldFont ); - SetBkMode( ps.hdc, OldBkMode ); - EndPaint( hWnd, &ps ); -} - -void PaintR4300iMIPanel (HWND hWnd) { - PAINTSTRUCT ps; - RECT rcBox; - HFONT hOldFont; - int OldBkMode; - BeginPaint( hWnd, &ps ); - - rcBox.left = 175; - rcBox.top = 64; - rcBox.right = 475; - rcBox.bottom = 210; - DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT ); - - hOldFont = SelectObject( ps.hdc, - GetStockObject(DEFAULT_GUI_FONT) ); - OldBkMode = SetBkMode( ps.hdc, TRANSPARENT ); - - TextOut( ps.hdc, 210,86,"MI_MODE_REG:",12); - TextOut( ps.hdc, 210,116,"MI_VERSION_REG:",15); - TextOut( ps.hdc, 210,146,"MI_INTR_REG:",12); - TextOut( ps.hdc, 210,176,"MI_INTR_MASK_REG:",17); - - SelectObject( ps.hdc,hOldFont ); - SetBkMode( ps.hdc, OldBkMode ); - EndPaint( hWnd, &ps ); -} - -void PaintR4300iPIPanel (HWND hWnd) { - PAINTSTRUCT ps; - RECT rcBox; - HFONT hOldFont; - int OldBkMode; - BeginPaint( hWnd, &ps ); - - rcBox.left = 85; - rcBox.top = 34; - rcBox.right = 575; - rcBox.bottom = 270; - DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT ); - - hOldFont = SelectObject( ps.hdc, GetStockObject(DEFAULT_GUI_FONT) ); - OldBkMode = SetBkMode( ps.hdc, TRANSPARENT ); - - TextOut( ps.hdc, 95,55,"PI_DRAM_ADDR_REG:",17); - TextOut( ps.hdc, 95,85,"PI_CART_ADDR_REG:",17); - TextOut( ps.hdc, 95,115,"PI_RD_LEN_REG:",14); - TextOut( ps.hdc, 95,145,"PI_WR_LEN_REG:",14); - TextOut( ps.hdc, 95,175,"PI_STATUS_REG:",14); - TextOut( ps.hdc, 95,205,"PI_DOMAIN1_REG:",15); - TextOut( ps.hdc, 95,235,"PI_BSD_DOM1_PWD_REG:",20); - TextOut( ps.hdc, 330,55,"PI_BSD_DOM1_PGS_REG:",20); - TextOut( ps.hdc, 330,85,"PI_BSD_DOM1_RLS_REG:",20); - TextOut( ps.hdc, 330,115,"PI_DOMAIN2_REG:",15); - TextOut( ps.hdc, 330,145,"PI_BSD_DOM2_PWD_REG:",20); - TextOut( ps.hdc, 330,175,"PI_BSD_DOM2_PGS_REG:",20); - TextOut( ps.hdc, 330,205,"PI_BSD_DOM2_RLS_REG:",20); - - SelectObject( ps.hdc,hOldFont ); - SetBkMode( ps.hdc, OldBkMode ); - EndPaint( hWnd, &ps ); -} - -void PaintR4300iVIPanel (HWND hWnd) { - PAINTSTRUCT ps; - RECT rcBox; - HFONT hOldFont; - int OldBkMode; - BeginPaint( hWnd, &ps ); - - rcBox.left = 85; - rcBox.top = 34; - rcBox.right = 575; - rcBox.bottom = 270; - DrawEdge( ps.hdc, &rcBox, EDGE_ETCHED, BF_RECT ); - - hOldFont = SelectObject( ps.hdc,GetStockObject(DEFAULT_GUI_FONT) ); - OldBkMode = SetBkMode( ps.hdc, TRANSPARENT ); - - TextOut( ps.hdc, 95,55,"VI_STATUS_REG:",14); - TextOut( ps.hdc, 95,85,"VI_DRAM_ADDR_REG:",17); - TextOut( ps.hdc, 95,115,"VI_WIDTH_REG:",13); - TextOut( ps.hdc, 95,145,"VI_INTR_REG:",12); - TextOut( ps.hdc, 95,175,"VI_V_CURRENT_LINE_REG:",22); - TextOut( ps.hdc, 95,205,"VI_TIMING_REG:",14); - TextOut( ps.hdc, 95,235,"VI_V_SYNC_REG:",14); - TextOut( ps.hdc, 345,55,"VI_H_SYNC_REG:",14); - TextOut( ps.hdc, 345,85,"VI_H_SYNC_LEAP_REG:",19); - TextOut( ps.hdc, 345,115,"VI_H_START_REG:",15); - TextOut( ps.hdc, 345,145,"VI_V_START_REG:",15); - TextOut( ps.hdc, 345,175,"VI_V_BURST_REG:",15); - TextOut( ps.hdc, 345,205,"VI_X_SCALE_REG:",15); - TextOut( ps.hdc, 345,235,"VI_Y_SCALE_REG:",15); - - SelectObject( ps.hdc,hOldFont ); - SetBkMode( ps.hdc, OldBkMode ); - EndPaint( hWnd, &ps ); -} - -LRESULT CALLBACK R4300i_Registers_Proc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - static RECT rcDisp; - static int CurrentPanel = GeneralPurpose; - TC_ITEM item; - - switch (uMsg) { - case WM_INITDIALOG: - R4300i_Registers_hDlg = hDlg; - SetupR4300iRegistersMain( hDlg ); - break; - case WM_MOVE: - StoreCurrentWinPos("R4300i Registers",hDlg); - break; - case WM_SIZE: - GetClientRect( hDlg, &rcDisp); - TabCtrl_AdjustRect( hTab, FALSE, &rcDisp ); - break; - case WM_NOTIFY: - switch (((NMHDR *)lParam)->code) { - case TCN_SELCHANGE: - InvalidateRect( hTab, &rcDisp, TRUE ); - HideR4300iRegisterPanel (CurrentPanel); - item.mask = TCIF_PARAM; - TabCtrl_GetItem( hTab, TabCtrl_GetCurSel( hTab ), &item ); - CurrentPanel = item.lParam; - InvalidateRect( hStatic, NULL, FALSE ); - UpdateCurrentR4300iRegisterPanel(); - ShowR4300iRegisterPanel ( CurrentPanel ); - break; - } - break; - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDCANCEL: - CurrentPanel = GeneralPurpose; - EndDialog( hDlg, IDCANCEL ); - break; - } - break; - default: - return FALSE; - } - return TRUE; -} - -LRESULT CALLBACK RefreshR4300iRegProc ( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { - int nSel; - TC_ITEM item; - - switch( uMsg ) { - case WM_PAINT: - nSel = TabCtrl_GetCurSel( hTab ); - if ( nSel > -1 ) { - item.mask = TCIF_PARAM; - TabCtrl_GetItem( hTab, nSel, &item ); - switch( item.lParam ) { - case GeneralPurpose: - PaintR4300iGPRPanel (hWnd); - break; - case ControlProcessor0: - PaintR4300iCP0Panel (hWnd); - break; - case FloatingRegisters: - PaintR4300iFPRPanel (hWnd); - break; - case SpecialRegister: - PaintR4300iSpecialPanel (hWnd); - break; - case RDRAMRegisters: - PaintR4300iRDRamPanel (hWnd); - break; - case SPRegisters: - PaintR4300iSPPanel (hWnd); - break; - case MIPSInterface: - PaintR4300iMIPanel (hWnd); - break; - case VideoInterface: - PaintR4300iVIPanel (hWnd); - break; - case AudioInterface: - PaintR4300iAIPanel (hWnd); - break; - case PeripheralInterface: - PaintR4300iPIPanel (hWnd); - break; - case RDRAMInterface: - PaintR4300iRIPanel (hWnd); - break; - case SerialInterface: - PaintR4300iSIPanel (hWnd); - break; - } - - } - break; - default: - return( (*r4300iRegRefreshProc)(hWnd, uMsg, wParam, lParam) ); - } - return( FALSE ); -} - -void SetupR4300iAIPanel (HWND hDlg) { - int count; - - for (count = 0; count < 6;count ++) { - hAI[count] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,342,(count*30) + 69,80,19, - hDlg,0,hInst, NULL ); - SendMessage(hAI[count],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } -} - -void SetupR4300iCP0Panel (HWND hDlg) { - int count, top; - for (count = 0;count < 32;count ++) { hCP0[count] = NULL; } - top = 53; - for (count = 0; count < 10;count ++) { - if (count == 7) { continue; } - hCP0[count] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,130,top,80,19, - hDlg,0,hInst, NULL ); - SendMessage(hCP0[count],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - top += 24; - } - - top = 53; - for (count = 0; count < 8;count ++) { - hCP0[count + 10] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,330,top,80,19, - hDlg,0,hInst, NULL ); - SendMessage(hCP0[count + 10],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - top += 24; - } - - top = 53; - for (count = 0; count < 13;count ++) { - if (count >= 3 && count <= 7 ) { continue; } - hCP0[count + 18] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,535,top,80,19, - hDlg,0,hInst, NULL ); - SendMessage(hCP0[count + 18],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - top += 24; - } - -} - -void SetupR4300iFPRPanel (HWND hDlg) { - int count; - - for (count = 0; count < 11;count ++) { - hFPR[count] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,90,(count*20) + 50,135,19, - hDlg,0,hInst, NULL ); - SendMessage(hFPR[count],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - - } - for (count = 0; count < 11;count ++) { - hFPR[count + 11] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,300,(count*20) + 50,135,19, - hDlg,0,hInst, NULL ); - SendMessage(hFPR[ count + 11 ],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } - for (count = 0; count < 10;count ++) { - hFPR[count + 22] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,510,(count*20) + 50,135,19, - hDlg,0,hInst, NULL ); - SendMessage(hFPR[ count + 22 ],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } -} - -void SetupR4300iGPRPanel (HWND hDlg) { - int count; - - for (count = 0; count < 11;count ++) { - hGPR[count] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,90,(count*20) + 50,135,19, - hDlg,0,hInst, NULL ); - SendMessage(hGPR[count],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - - } - for (count = 0; count < 11;count ++) { - hGPR[count + 11] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,300,(count*20) + 50,135,19, - hDlg,0,hInst, NULL ); - SendMessage(hGPR[ count + 11 ],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } - for (count = 0; count < 10;count ++) { - hGPR[count + 22] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,510,(count*20) + 50,135,19, - hDlg,0,hInst, NULL ); - SendMessage(hGPR[ count + 22 ],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } -} - -void SetupR4300iMIPanel (HWND hDlg) { - int count; - - for (count = 0; count < 4;count ++) { - hMI[count] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,340,(count*30) + 89,80,19, - hDlg,0,hInst, NULL ); - SendMessage(hMI[count],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } -} - -void SetupR4300iPIPanel (HWND hDlg) { - int count; - - for (count = 0; count < 7;count ++) { - hPI[count] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,245,(count*30) + 58,80,19, - hDlg,0,hInst, NULL ); - SendMessage(hPI[count],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } - for (count = 0; count < 6;count ++) { - hPI[count + 7] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,480,(count*30) + 58,80,19, - hDlg,0,hInst, NULL ); - SendMessage(hPI[count + 7],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } -} - -void SetupR4300iRDRamPanel (HWND hDlg) { - int count; - - for (count = 0; count < 10;count ++) { - hRDRam[count] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,375,(count*20) + 58,80,19, - hDlg,0,hInst, NULL ); - SendMessage(hRDRam[count],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } -} - -void SetupR4300iRIPanel (HWND hDlg) { - int count; - - for (count = 0; count < 4;count ++) { - hRI[count] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,260,(count*30) + 90,80,19, - hDlg,0,hInst, NULL ); - SendMessage(hRI[count],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } - - for (count = 0; count < 4;count ++) { - hRI[count + 4] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,475,(count*30) + 90,80,19, - hDlg,0,hInst, NULL ); - SendMessage(hRI[count + 4],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } -} - -void SetupR4300iSIPanel (HWND hDlg) { - int count; - - for (count = 0; count < 4;count ++) { - hSI[count] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,360,(count*30) + 89,80,19, - hDlg,0,hInst, NULL ); - SendMessage(hSI[count],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } - -} - -void SetupR4300iSPPanel (HWND hDlg) { - int count; - - for (count = 0; count < 5;count ++) { - hSP[count] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,250,(count*30) + 84,80,19, - hDlg,0,hInst, NULL ); - SendMessage(hSP[count],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } - for (count = 0; count < 5;count ++) { - hSP[count + 5] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,475,(count*30) + 84,80,19, - hDlg,0,hInst, NULL ); - SendMessage(hSP[ count + 5 ],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } -} - -void SetupR4300iSpecialPanel (HWND hDlg) { - int count; - hSpecial[0] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,345,70,80,19, - hDlg,0,hInst, NULL ); - hSpecial[1] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,345,100,135,19, - hDlg,0,hInst, NULL ); - hSpecial[2] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,345,130,135,19, - hDlg,0,hInst, NULL ); - hSpecial[3] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,345,160,34,19, - hDlg,0,hInst, NULL ); - hSpecial[4] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,345,190,80,19, - hDlg,0,hInst, NULL ); - hSpecial[5] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,345,220,80,19, - hDlg,0,hInst, NULL ); - for (count = 0; count < 6;count ++) { - SendMessage(hSpecial[count],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } -} - -void SetupR4300iVIPanel (HWND hDlg) { - int count; - - for (count = 0; count < 7;count ++) { - hVI[count] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,250,(count*30) + 58,80,19, - hDlg,0,hInst, NULL ); - SendMessage(hVI[count],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } - for (count = 0; count < 7;count ++) { - hVI[count + 7] = CreateWindowEx(WS_EX_CLIENTEDGE,"EDIT","", WS_CHILD | - ES_READONLY | WS_BORDER | WS_TABSTOP,480,(count*30) + 58,80,19, - hDlg,0,hInst, NULL ); - SendMessage(hVI[count + 7],WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT),0); - } -} - -void SetupR4300iRegistersMain (HWND hDlg) { -#define WindowWidth 675 -#define WindowHeight 325 - DWORD X, Y; - - hTab = CreateWindowEx(0,WC_TABCONTROL,"", WS_TABSTOP | WS_CHILD | WS_VISIBLE,5,6,660,290, - hDlg,(HMENU)IDC_TAB_CONTROL,hInst,NULL ); - if ( hTab ) { - TC_ITEM item; - SendMessage(hTab, WM_SETFONT, (WPARAM)GetStockObject( DEFAULT_GUI_FONT ), 0); - item.mask = TCIF_TEXT | TCIF_PARAM; - item.pszText = " General Purpose "; - item.lParam = GeneralPurpose; - TabCtrl_InsertItem( hTab,0, &item); - item.lParam = ControlProcessor0; - item.pszText = " Control Processor 0 "; - TabCtrl_InsertItem( hTab,1, &item); - item.lParam = FloatingRegisters; - item.pszText = " floating-point Registers "; - TabCtrl_InsertItem( hTab,2, &item); - item.lParam = SpecialRegister; - item.pszText = " Special Registers "; - TabCtrl_InsertItem( hTab,3, &item); - item.lParam = RDRAMRegisters; - item.pszText = " RDRAM Registers "; - TabCtrl_InsertItem( hTab,4, &item); - item.lParam = SPRegisters; - item.pszText = " SP Registers "; - TabCtrl_InsertItem( hTab,5, &item); - item.lParam = MIPSInterface; - item.pszText = " MIPS Interface "; - TabCtrl_InsertItem( hTab,6, &item); - item.lParam = VideoInterface ; - item.pszText = " Video Interface "; - TabCtrl_InsertItem( hTab,7, &item); - item.lParam = AudioInterface ; - item.pszText = " Audio Interface "; - TabCtrl_InsertItem( hTab,8, &item); - item.lParam = PeripheralInterface; - item.pszText = " Peripheral Interface "; - TabCtrl_InsertItem( hTab,9, &item); - item.lParam = RDRAMInterface; - item.pszText = " RDRAM Interface "; - TabCtrl_InsertItem( hTab,10, &item); - item.lParam = SerialInterface; - item.pszText = " Serial Interface "; - TabCtrl_InsertItem( hTab,11, &item); - } - - SetupR4300iAIPanel ( hDlg ); - SetupR4300iCP0Panel ( hDlg ); - SetupR4300iFPRPanel ( hDlg ); - SetupR4300iGPRPanel ( hDlg ); - SetupR4300iMIPanel ( hDlg ); - SetupR4300iRDRamPanel ( hDlg ); - SetupR4300iPIPanel ( hDlg ); - SetupR4300iRIPanel ( hDlg ); - SetupR4300iSIPanel ( hDlg ); - SetupR4300iSPPanel ( hDlg ); - SetupR4300iSpecialPanel ( hDlg ); - SetupR4300iVIPanel ( hDlg); - - hStatic = CreateWindowEx(0,"STATIC","", WS_CHILD|WS_VISIBLE, 5,6,660,290,hDlg,0,hInst,NULL ); - r4300iRegRefreshProc = (FARPROC)SetWindowLong( hStatic,GWL_WNDPROC,(long)RefreshR4300iRegProc); - - ShowR4300iRegisterPanel ( GeneralPurpose ); - UpdateCurrentR4300iRegisterPanel (); - SetWindowText(hDlg," R4300i Registers"); - - if ( !GetStoredWinPos( "R4300i Registers", &X, &Y ) ) { - X = (GetSystemMetrics( SM_CXSCREEN ) - WindowWidth) / 2; - Y = (GetSystemMetrics( SM_CYSCREEN ) - WindowHeight) / 2; - } - SetWindowPos(hDlg,NULL,X,Y,WindowWidth,WindowHeight, SWP_NOZORDER | SWP_SHOWWINDOW); -} - -void ShowR4300iRegisterPanel ( int Panel) { - int count; - - switch( Panel ) { - case GeneralPurpose: - for (count = 0; count < 32;count ++) { ShowWindow(hGPR[count],TRUE); } - break; - case ControlProcessor0: - for (count = 0; count < 32;count ++) { ShowWindow(hCP0[count],TRUE); } - break; - case FloatingRegisters: - for (count = 0; count < 32;count ++) { ShowWindow(hFPR[count],TRUE); } - break; - case SpecialRegister: - for (count = 0; count < 6;count ++) { ShowWindow(hSpecial[count],TRUE); } - break; - case RDRAMRegisters: - for (count = 0; count < 10;count ++) { ShowWindow(hRDRam[count],TRUE); } - break; - case SPRegisters: - for (count = 0; count < 10;count ++) { ShowWindow(hSP[count],TRUE); } - break; - case MIPSInterface: - for (count = 0; count < 4;count ++) { ShowWindow(hMI[count],TRUE); } - break; - case VideoInterface: - for (count = 0; count < 14;count ++) { ShowWindow(hVI[count],TRUE); } - break; - case AudioInterface: - for (count = 0; count < 6;count ++) { ShowWindow(hAI[count],TRUE); } - break; - case PeripheralInterface: - for (count = 0; count < 13;count ++) { ShowWindow(hPI[count],TRUE); } - break; - case RDRAMInterface: - for (count = 0; count < 8;count ++) { ShowWindow(hRI[count],TRUE); } - break; - case SerialInterface: - for (count = 0; count < 4;count ++) { ShowWindow(hSI[count],TRUE); } - break; - } -} - -void __cdecl UpdateCurrentR4300iRegisterPanel ( void ) { - char RegisterValue[60], OldWinText[60]; - int count, nSel; - TC_ITEM item; - - if (!InR4300iRegisterWindow) { return; } - nSel = TabCtrl_GetCurSel( hTab ); - if ( nSel > -1 ) { - item.mask = TCIF_PARAM; - TabCtrl_GetItem( hTab, nSel, &item ); - switch( item.lParam ) { - case GeneralPurpose: - for (count = 0; count < 32;count ++) { - GetWindowText(hGPR[count],OldWinText,60); - sprintf(RegisterValue," 0x%08X - %08X",GPR[count].W[1],GPR[count].W[0]); - if ( strcmp( RegisterValue, OldWinText) != 0 ) { - SetWindowText(hGPR[count],RegisterValue); - } - } - break; - case ControlProcessor0: - for (count = 0; count < 32;count ++) { - GetWindowText(hCP0[count],OldWinText,60); - sprintf( RegisterValue," 0x%08X",CP0[count] ); - if ( strcmp( RegisterValue, OldWinText) != 0 ) { - SetWindowText(hCP0[count],RegisterValue); - } - } - break; - case FloatingRegisters: - for (count = 0; count < 32;count ++) { - GetWindowText(hFPR[count],OldWinText,60); - sprintf(RegisterValue," 0x%08X - %08X",FPR[count].W[1],FPR[count].W[0]); - if ( strcmp( RegisterValue, OldWinText) != 0 ) { - SetWindowText(hFPR[count],RegisterValue); - } - } - break; - case SpecialRegister: - GetWindowText(hSpecial[0],OldWinText,60); - sprintf( RegisterValue," 0x%08X",PROGRAM_COUNTER ); - if ( strcmp( RegisterValue, OldWinText) != 0 ) { - SetWindowText(hSpecial[0],RegisterValue); - } - GetWindowText(hSpecial[0],OldWinText,60); - sprintf(RegisterValue," 0x%08X - %08X",HI.W[1],HI.W[0]); - if ( strcmp( RegisterValue, OldWinText) != 0 ) { - SetWindowText(hSpecial[1],RegisterValue); - } - GetWindowText(hSpecial[0],OldWinText,60); - sprintf(RegisterValue," 0x%08X - %08X",LO.W[1],LO.W[0]); - if ( strcmp( RegisterValue, OldWinText) != 0 ) { - SetWindowText(hSpecial[2],RegisterValue); - } - GetWindowText(hSpecial[0],OldWinText,60); - sprintf(RegisterValue," 0x%08X",REVISION_REGISTER); - if ( strcmp( RegisterValue, OldWinText) != 0 ) { - SetWindowText(hSpecial[4],RegisterValue); - } - GetWindowText(hSpecial[0],OldWinText,60); - sprintf(RegisterValue," 0x%08X",FSTATUS_REGISTER); - if ( strcmp( RegisterValue, OldWinText) != 0 ) { - SetWindowText(hSpecial[5],RegisterValue); - } - break; - case RDRAMRegisters: - for (count = 0; count < 10;count ++) { - GetWindowText(hRDRam[count],OldWinText,60); - sprintf(RegisterValue," 0x%08X",RegRDRAM[count]); - if ( strcmp( RegisterValue, OldWinText) != 0 ) { - SetWindowText(hRDRam[count],RegisterValue); - } - } - break; - case SPRegisters: - for (count = 0; count < 10;count ++) { - GetWindowText(hSP[count],OldWinText,60); - sprintf(RegisterValue," 0x%08X",RegSP[count]); - if ( strcmp( RegisterValue, OldWinText) != 0 ) { - SetWindowText(hSP[count],RegisterValue); - } - } - break; - case MIPSInterface: - for (count = 0; count < 4;count ++) { - GetWindowText(hMI[count],OldWinText,60); - sprintf(RegisterValue," 0x%08X",RegMI[count]); - if ( strcmp( RegisterValue, OldWinText) != 0 ) { - SetWindowText(hMI[count],RegisterValue); - } - } - break; - case VideoInterface: - for (count = 0; count < 14;count ++) { - GetWindowText(hVI[count],OldWinText,60); - sprintf(RegisterValue," 0x%08X",RegVI[count]); - if ( strcmp( RegisterValue, OldWinText) != 0 ) { - SetWindowText(hVI[count],RegisterValue); - } - } - break; - case AudioInterface: - for (count = 0; count < 6;count ++) { - GetWindowText(hAI[count],OldWinText,60); - sprintf(RegisterValue," 0x%08X",RegAI[count]); - if ( strcmp( RegisterValue, OldWinText) != 0 ) { - SetWindowText(hAI[count],RegisterValue); - } - } - break; - case PeripheralInterface: - for (count = 0; count < 13;count ++) { - GetWindowText(hPI[count],OldWinText,60); - sprintf(RegisterValue," 0x%08X",RegPI[count]); - if ( strcmp( RegisterValue, OldWinText) != 0 ) { - SetWindowText(hPI[count],RegisterValue); - } - } - break; - case RDRAMInterface: - for (count = 0; count < 8;count ++) { - GetWindowText(hRI[count],OldWinText,60); - sprintf(RegisterValue," 0x%08X",RegRI[count]); - if ( strcmp( RegisterValue, OldWinText) != 0 ) { - SetWindowText(hRI[count],RegisterValue); - } - } - break; - case SerialInterface: - for (count = 0; count < 4;count ++) { - GetWindowText(hSI[count],OldWinText,60); - sprintf(RegisterValue," 0x%08X",RegSI[count]); - if ( strcmp( RegisterValue, OldWinText) != 0 ) { - SetWindowText(hSI[count],RegisterValue); - } - } - break; - } - } -} -#endif - -#endif \ No newline at end of file diff --git a/Source/Project64/N64 System/C Core/r4300i Registers.h b/Source/Project64/N64 System/C Core/r4300i Registers.h deleted file mode 100644 index 28f5abccc..000000000 --- a/Source/Project64/N64 System/C Core/r4300i Registers.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Project 64 - A Nintendo 64 emulator. - * - * (c) Copyright 2001 zilmar (zilmar@emulation64.com) and - * Jabo (jabo@emulation64.com). - * - * pj64 homepage: www.pj64.net - * - * Permission to use, copy, modify and distribute Project64 in both binary and - * source form, for non-commercial purposes, is hereby granted without fee, - * providing that this license information and copyright notice appear with - * all copies and any derived work. - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event shall the authors be held liable for any damages - * arising from the use of this software. - * - * Project64 is freeware for PERSONAL USE only. Commercial users should - * seek permission of the copyright holders first. Commercial use includes - * charging money for Project64 or software derived from Project64. - * - * The copyright holders request that bug fixes and improvements to the code - * should be forwarded to them so if they want them. - * - */ -#ifndef __r4300i_Registers_h -#define __r4300i_Registers_h - -void __cdecl Enter_R4300i_Register_Window ( void ); -void __cdecl UpdateCurrentR4300iRegisterPanel ( void ); - -#endif \ No newline at end of file diff --git a/Source/Project64/N64 System/Mips/Mempak.H b/Source/Project64/N64 System/Mips/Mempak.H index 092a2e71e..5f5a13935 100644 --- a/Source/Project64/N64 System/Mips/Mempak.H +++ b/Source/Project64/N64 System/Mips/Mempak.H @@ -6,8 +6,8 @@ class Mempak public: static void Close ( void ); static BYTE CalculateCrc ( BYTE * DataToCrc ); - static void ReadFrom ( int Control, int Address, BYTE * Buffer ); - static void WriteTo ( int Control, int Address, BYTE * Buffer ); + static void ReadFrom ( int Control, int Address, BYTE * Buffer ); + static void WriteTo ( int Control, int Address, BYTE * Buffer ); }; #endif //_MEMPAK_H_ \ No newline at end of file diff --git a/Source/Project64/N64 System/Mips/Mempak.cpp b/Source/Project64/N64 System/Mips/Mempak.cpp index f3e910f78..f6ab529d8 100644 --- a/Source/Project64/N64 System/Mips/Mempak.cpp +++ b/Source/Project64/N64 System/Mips/Mempak.cpp @@ -10,7 +10,7 @@ void Mempak::Close(void) { } void LoadMempak (void) { - char File[256], Directory[256]; + CPath FileName; DWORD dwRead, count, count2; BYTE Initilize[] = { @@ -40,27 +40,24 @@ void LoadMempak (void) { memcpy(&Mempaks[count][0],Initilize,sizeof(Initilize)); } - strcpy(Directory,_Settings->LoadString(Directory_NativeSave).c_str()); - sprintf(File,"%s%s.mpk",Directory,_Settings->LoadString(Game_GameName).c_str()); + FileName.SetDriveDirectory( _Settings->LoadString(Directory_NativeSave).c_str()); + FileName.SetName(_Settings->LoadString(Game_GameName).c_str()); + FileName.SetExtension("mpk"); + + if (!FileName.DirectoryExists()) + { + FileName.CreateDirectory(); + } hMempakFile = CreateFile(File,GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ,NULL,OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL); - if (hMempakFile == INVALID_HANDLE_VALUE) { - switch (GetLastError()) { - case ERROR_PATH_NOT_FOUND: - CreateDirectory(Directory,NULL); - hMempakFile = CreateFile(File,GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ, - NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, NULL); - if (hMempakFile == INVALID_HANDLE_VALUE) { - _Notify->DisplayError(GS(MSG_FAIL_OPEN_MEMPAK)); - } - return; - break; - default: - _Notify->DisplayError(GS(MSG_FAIL_OPEN_MEMPAK)); - return; - } + + if (m_hFile == INVALID_HANDLE_VALUE) + { + WriteTraceF(TraceError,"Mempak::LoadMempak: Failed to open (%s), ReadOnly = %d, LastError = %X",(LPCTSTR)FileName, m_ReadOnly, GetLastError()); + return; } + SetFilePointer(hMempakFile,0,NULL,FILE_BEGIN); ReadFile(hMempakFile,Mempaks,sizeof(Mempaks),&dwRead,NULL); WriteFile(hMempakFile,Mempaks,sizeof(Mempaks),&dwRead,NULL); diff --git a/Source/Project64/Project64.vcproj b/Source/Project64/Project64.vcproj index 6886c39a2..04e5322fe 100644 --- a/Source/Project64/Project64.vcproj +++ b/Source/Project64/Project64.vcproj @@ -570,14 +570,6 @@ - - - - @@ -586,10 +578,6 @@ RelativePath="N64 System\C Core\r4300i Commands.cpp" > - - - - @@ -1311,10 +1295,6 @@ RelativePath="N64 System\C Core\r4300i Commands.h" > - -