- put the WX libraries into the project settings. (I had to do it with Notepad++ to be compatible with x64. Hoping I didn't fuck up anything but everything should be ok). Start getting rid of those #pragma comment's.
- first attempt at implementing touchscreen. Doesn't work, probably due to crossplatformness issues. >_<
This commit is contained in:
luigi__ 2010-06-23 22:11:53 +00:00
parent a562c7f966
commit 90086cf357
2 changed files with 316 additions and 265 deletions

View File

@ -79,7 +79,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Rpcrt4.lib directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-Win32-debug.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib comctl32.lib"
AdditionalDependencies="Rpcrt4.lib directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-Win32-debug.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib comctl32.lib wxbase28d.lib wxmsw28d_core.lib"
OutputFile="$(OutDir)\$(ProjectName)_debug.exe"
AdditionalLibraryDirectories="..\windows\zlib123;..\windows\agg;.libs"
DelayLoadDLLs=""
@ -170,7 +170,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Rpcrt4.lib directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-x64.lib glib-vc8-x64.lib 7z-vc8-x64.lib zlib-vc8-x64.lib agg-2.5-x64.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib comctl32.lib"
AdditionalDependencies="Rpcrt4.lib directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-x64.lib glib-vc8-x64.lib 7z-vc8-x64.lib zlib-vc8-x64.lib agg-2.5-x64.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib comctl32.lib wxbase28d-x64.lib wxmsw28d_core-x64.lib"
OutputFile="$(OutDir)\$(ProjectName)_x64_debug.exe"
AdditionalLibraryDirectories="..\windows\zlib123;..\windows\agg;.libs"
GenerateDebugInformation="true"
@ -263,7 +263,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Rpcrt4.lib directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-Win32.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib comctl32.lib"
AdditionalDependencies="Rpcrt4.lib directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-Win32.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib comctl32.lib wxbase28.lib wxmsw28_core.lib"
OutputFile="$(OutDir)\$(ProjectName)_release.exe"
AdditionalLibraryDirectories="..\windows\zlib123;..\windows\agg;.libs"
DelayLoadDLLs=""
@ -358,7 +358,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-x64.lib glib-vc8-x64.lib 7z-vc8-x64.lib zlib-vc8-x64.lib agg-2.5-x64.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib"
AdditionalDependencies="directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-x64.lib glib-vc8-x64.lib 7z-vc8-x64.lib zlib-vc8-x64.lib agg-2.5-x64.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib wxbase28-x64.lib wxmsw28_core-x64.lib"
OutputFile="$(OutDir)\$(ProjectName)_x64_release.exe"
AdditionalLibraryDirectories="..\windows\zlib123;..\windows\agg;.libs"
GenerateDebugInformation="true"
@ -452,7 +452,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Rpcrt4.lib directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-Win32.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib comctl32.lib"
AdditionalDependencies="Rpcrt4.lib directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-Win32.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib comctl32.lib wxbase28.lib wxmsw28_core.lib"
OutputFile="$(OutDir)\$(ProjectName)_dev+.exe"
AdditionalLibraryDirectories="..\windows\zlib123;..\windows\agg;.libs"
DelayLoadDLLs=""
@ -548,7 +548,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-x64.lib glib-vc8-x64.lib 7z-vc8-x64.lib zlib-vc8-x64.lib agg-2.5-x64.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib"
AdditionalDependencies="directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib lua-vc8-x64.lib glib-vc8-x64.lib 7z-vc8-x64.lib zlib-vc8-x64.lib agg-2.5-x64.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib wxbase28-x64.lib wxmsw28_core-x64.lib"
OutputFile="$(OutDir)\$(ProjectName)_x64_dev+.exe"
AdditionalLibraryDirectories="..\windows\zlib123;..\windows\agg;.libs"
GenerateDebugInformation="true"

View File

@ -12,25 +12,7 @@
#include "OGLRender.h"
#include "firmware.h"
#ifdef WIN32
#ifdef _M_X64
#ifndef NDEBUG
#pragma comment(lib,"wxmsw28d_core-x64.lib")
#pragma comment(lib,"wxbase28d-x64.lib")
#else
#pragma comment(lib,"wxmsw28_core-x64.lib")
#pragma comment(lib,"wxbase28-x64.lib")
#endif
#else
#ifndef NDEBUG
#pragma comment(lib,"wxmsw28d_core.lib")
#pragma comment(lib,"wxbase28d.lib")
#else
#pragma comment(lib,"wxmsw28_core.lib")
#pragma comment(lib,"wxbase28.lib")
#endif
#endif
#else
#ifndef WIN32
#define lstrlen(a) strlen((a))
#endif
@ -48,18 +30,19 @@
#include <wx/wx.h>
#endif
#ifdef GDB_STUB
#include "gdbstub.h"
#endif
#include <wx/config.h>
#include <wx/docview.h>
#ifdef GDB_STUB
#include "gdbstub.h"
#endif
#include <wx/config.h>
#include <wx/docview.h>
#define SCREEN_SIZE (256*192*3)
#define GAP_DEFAULT 64
#define GAP_MAX 90
static int nds_gap_size;
static int nds_screen_rotation_angle;
static bool Touch = false;
#define SCREEN_SIZE (256*192*3)
#define GAP_DEFAULT 64
#define GAP_MAX 90
static int nds_gap_size;
static int nds_screen_rotation_angle;
SoundInterface_struct *SNDCoreList[] = {
&SNDDummy,
#ifdef WIN32
@ -91,17 +74,17 @@ class DesmumeFrame: public wxFrame
{
public:
DesmumeFrame(const wxString& title);
~DesmumeFrame() {
delete history;
}
void OnQuit(wxCommandEvent& WXUNUSED(event))
{
execute = false;
NDS_DeInit();
Close(true);
~DesmumeFrame() {
delete history;
}
void OnQuit(wxCommandEvent& WXUNUSED(event))
{
execute = false;
NDS_DeInit();
Close(true);
}
void OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxMessageBox(
@ -180,89 +163,151 @@ public:
void LoadRom(wxCommandEvent& event){
wxFileDialog dialog(this,_T("Load Rom"),wxGetHomeDir(),_T(""),_T("*.nds"),wxFD_OPEN, wxDefaultPosition, wxDefaultSize);
if(dialog.ShowModal() == wxID_OK) {
history->AddFileToHistory(dialog.GetPath());
history->AddFileToHistory(dialog.GetPath());
execute = true;
NDS_LoadROM(dialog.GetPath().mb_str(), dialog.GetPath().mb_str());
}
}
void gpu_screen_to_rgb(u8 *rgb1, u8 *rgb2)
{
u16 gpu_pixel;
u8 pixel[3];
u8 *rgb = rgb1;
const int rot = nds_screen_rotation_angle;
int done = false;
int offset = 0;
loop:
for (int i = 0; i < 256; i++) {
for (int j = 0; j < 192; j++) {
gpu_pixel = *((u16 *) & GPU_screen[(i + (j + offset) * 256) << 1]);
pixel[0] = ((gpu_pixel >> 0) & 0x1f) << 3;
pixel[1] = ((gpu_pixel >> 5) & 0x1f) << 3;
pixel[2] = ((gpu_pixel >> 10) & 0x1f) << 3;
switch (rot) {
case 0:
memcpy(rgb+((i+j*256)*3),pixel,3);
break;
case 90:
memcpy(rgb+SCREEN_SIZE-((j+(255-i)*192)*3)-3,pixel,3);
break;
case 180:
memcpy(rgb+SCREEN_SIZE-((i+j*256)*3)-3,pixel,3);
break;
case 270:
memcpy(rgb+((j+(255-i)*192)*3),pixel,3);
break;
}
}
}
if (done == false) {
offset = 192;
rgb = rgb2;
done = true;
goto loop;
}
}
//TODO should integrate filter system
void onPaint(wxPaintEvent &event)
{
u8 rgb1[SCREEN_SIZE], rgb2[SCREEN_SIZE];
wxPaintDC dc(this);
int w, h;
if (nds_screen_rotation_angle == 90 || nds_screen_rotation_angle == 270) {
w = 192;
h = 256;
} else {
w = 256;
h = 192;
}
gpu_screen_to_rgb(rgb1, rgb2);
wxBitmap m_bitmap1(wxImage(w, h, rgb1, true));
wxBitmap m_bitmap2(wxImage(w, h, rgb2, true));
switch (nds_screen_rotation_angle) {
case 0:
dc.DrawBitmap(m_bitmap1, 0, 0, true);
dc.DrawBitmap(m_bitmap2, 0, 192+nds_gap_size, true);
break;
case 90:
dc.DrawBitmap(m_bitmap2, 0, 0, true);
dc.DrawBitmap(m_bitmap1, 192+nds_gap_size, 0, true);
break;
case 180:
dc.DrawBitmap(m_bitmap2, 0, 0, true);
dc.DrawBitmap(m_bitmap1, 0, 192+nds_gap_size, true);
break;
case 270:
dc.DrawBitmap(m_bitmap1, 0, 0, true);
dc.DrawBitmap(m_bitmap2, 192+nds_gap_size, 0, true);
break;
}
//----------------------------------------------------------------------------
// Touchscreen
//----------------------------------------------------------------------------
// De-transform coordinates.
// Returns true if the coordinates are within the touchscreen.
bool DetransformTouchCoords(int& X, int& Y)
{
int dtX, dtY;
// TODO: descaling (when scaling is supported)
// De-rotate coordinates
switch (nds_screen_rotation_angle)
{
case 0: dtX = X; dtY = Y - 191 - nds_gap_size; break;
case 90: dtX = Y; dtY = 191 - X; break;
case 180: dtX = 255 - X; dtY = 191 - Y; break;
case 270: dtX = 255 - Y; dtY = X - 191 - nds_gap_size; break;
}
// Atleast one of the coordinates is out of range
if ((dtX < 0) || (dtX > 255) || (dtY < 0) || (dtY > 191))
{
X = wxClip(dtX, 0, 255);
Y = wxClip(dtY, 0, 191);
return false;
}
else
{
X = dtX;
Y = dtY;
return true;
}
}
void OnTouchEvent(wxMouseEvent& evt)
{
wxPoint pt = evt.GetPosition();
bool inside = DetransformTouchCoords(pt.x, pt.y);
if (evt.LeftDown() && inside)
{
Touch = true;
NDS_setTouchPos((u16)pt.x, (u16)pt.y);
}
else if(evt.LeftUp() && Touch)
{
Touch = false;
NDS_releaseTouch();
}
else if (Touch)
{
NDS_setTouchPos((u16)pt.x, (u16)pt.y);
}
}
//----------------------------------------------------------------------------
// Video
//----------------------------------------------------------------------------
void gpu_screen_to_rgb(u8 *rgb1, u8 *rgb2)
{
u16 gpu_pixel;
u8 pixel[3];
u8 *rgb = rgb1;
const int rot = nds_screen_rotation_angle;
int done = false;
int offset = 0;
loop:
for (int i = 0; i < 256; i++) {
for (int j = 0; j < 192; j++) {
gpu_pixel = *((u16 *) & GPU_screen[(i + (j + offset) * 256) << 1]);
pixel[0] = ((gpu_pixel >> 0) & 0x1f) << 3;
pixel[1] = ((gpu_pixel >> 5) & 0x1f) << 3;
pixel[2] = ((gpu_pixel >> 10) & 0x1f) << 3;
switch (rot) {
case 0:
memcpy(rgb+((i+j*256)*3),pixel,3);
break;
case 90:
memcpy(rgb+SCREEN_SIZE-((j+(255-i)*192)*3)-3,pixel,3);
break;
case 180:
memcpy(rgb+SCREEN_SIZE-((i+j*256)*3)-3,pixel,3);
break;
case 270:
memcpy(rgb+((j+(255-i)*192)*3),pixel,3);
break;
}
}
}
if (done == false) {
offset = 192;
rgb = rgb2;
done = true;
goto loop;
}
}
//TODO should integrate filter system
void onPaint(wxPaintEvent &event)
{
u8 rgb1[SCREEN_SIZE], rgb2[SCREEN_SIZE];
wxPaintDC dc(this);
int w, h;
if (nds_screen_rotation_angle == 90 || nds_screen_rotation_angle == 270) {
w = 192;
h = 256;
} else {
w = 256;
h = 192;
}
gpu_screen_to_rgb(rgb1, rgb2);
wxBitmap m_bitmap1(wxImage(w, h, rgb1, true));
wxBitmap m_bitmap2(wxImage(w, h, rgb2, true));
switch (nds_screen_rotation_angle) {
case 0:
dc.DrawBitmap(m_bitmap1, 0, 0, true);
dc.DrawBitmap(m_bitmap2, 0, 192+nds_gap_size, true);
break;
case 90:
dc.DrawBitmap(m_bitmap2, 0, 0, true);
dc.DrawBitmap(m_bitmap1, 192+nds_gap_size, 0, true);
break;
case 180:
dc.DrawBitmap(m_bitmap2, 0, 0, true);
dc.DrawBitmap(m_bitmap1, 0, 192+nds_gap_size, true);
break;
case 270:
dc.DrawBitmap(m_bitmap1, 0, 0, true);
dc.DrawBitmap(m_bitmap2, 192+nds_gap_size, 0, true);
break;
}
}
void onIdle(wxIdleEvent &event){
@ -271,8 +316,8 @@ loop:
applyInput();
if(execute) {
NDS_exec<false>();
SPU_Emulate_user();
};
SPU_Emulate_user();
};
osd->update();
DrawHUD();
osd->clear();
@ -363,10 +408,10 @@ loop:
void closeRom(wxCommandEvent& event) {
NDS_FreeROM();
execute = false;
SPU_Pause(1);
#ifdef HAVE_LIBAGG
SPU_Pause(1);
#ifdef HAVE_LIBAGG
Hud.resetTransient();
#endif
#endif
NDS_Reset();
}
@ -399,9 +444,9 @@ loop:
void OnOpenLuaWindow(wxCommandEvent& WXUNUSED (event))
{
#ifdef WIN32
#ifdef WIN32
new wxLuaWindow(this, wxDefaultPosition, wxSize(600, 390));
#endif
#endif
}
void OnOpenControllerConfiguration(wxCommandEvent& WXUNUSED (event))
@ -424,24 +469,24 @@ loop:
void Menu_SaveStates(wxCommandEvent &event);
void Menu_LoadStates(wxCommandEvent &event);
void NDSInitialize();
void OnRotation(wxCommandEvent &event);
void ChangeRotation(int rot, bool skip);
void onResize(wxSizeEvent &event);
bool LoadSettings();
bool SaveSettings();
void OnClose(wxCloseEvent &event);
void OnOpenRecent(wxCommandEvent &event);
void OnRotation(wxCommandEvent &event);
void ChangeRotation(int rot, bool skip);
void onResize(wxSizeEvent &event);
bool LoadSettings();
bool SaveSettings();
void OnClose(wxCloseEvent &event);
void OnOpenRecent(wxCommandEvent &event);
private:
struct NDS_fw_config_data fw_config;
wxFileHistory* history;
#ifdef GDB_STUB
gdbstub_handle_t arm9_gdb_stub;
gdbstub_handle_t arm7_gdb_stub;
struct NDS_fw_config_data fw_config;
wxFileHistory* history;
#ifdef GDB_STUB
gdbstub_handle_t arm9_gdb_stub;
gdbstub_handle_t arm7_gdb_stub;
struct armcpu_memory_iface *arm9_memio;
struct armcpu_memory_iface *arm7_memio;
struct armcpu_ctrl_iface *arm9_ctrl_iface;
struct armcpu_ctrl_iface *arm7_ctrl_iface;
struct armcpu_ctrl_iface *arm9_ctrl_iface;
struct armcpu_ctrl_iface *arm7_ctrl_iface;
#endif
DECLARE_EVENT_TABLE()
};
@ -486,7 +531,7 @@ enum
wRot90,
wRot180,
wRot270,
/* stupid enums: these two should be the at the end */
/* stupid enums: these two should be the at the end */
wLoadState01,
wSaveState01 = wLoadState01+20
};
@ -494,52 +539,58 @@ enum
void DesmumeFrame::Menu_SaveStates(wxCommandEvent &event){savestate_slot(event.GetId() - wSaveState01);}
void DesmumeFrame::Menu_LoadStates(wxCommandEvent &event){loadstate_slot(event.GetId() - wLoadState01);}
void DesmumeFrame::OnRotation(wxCommandEvent &event) {
ChangeRotation((event.GetId() - wRot0)*90, true);
}
void DesmumeFrame::ChangeRotation(int rot, bool skip) {
wxSize sizeMin, sizeMax;
if (skip && rot == nds_screen_rotation_angle)
return;
SetMinSize(wxSize(-1,-1));
SetMaxSize(wxSize(-1,-1));
if (rot == 90 || rot == 270) {
SetClientSize(384 + nds_gap_size, 256);
sizeMax = sizeMin = ClientToWindowSize(wxSize(384,256));
sizeMax.IncBy(GAP_MAX,0);
} else {
SetClientSize(256, 384 + nds_gap_size);
sizeMax = sizeMin = ClientToWindowSize(wxSize(256,384));
sizeMax.IncBy(0,GAP_MAX);
}
SetMinSize(sizeMin);
SetMaxSize(sizeMax);
nds_screen_rotation_angle = rot;
}
void DesmumeFrame::onResize(wxSizeEvent &event) {
int w, h;
GetClientSize(&w,&h);
if (nds_screen_rotation_angle == 90 || nds_screen_rotation_angle == 270) {
if (w>=384)
nds_gap_size = w-384;
} else {
if (h>=384)
nds_gap_size = h-384;
}
event.Skip();
}
void DesmumeFrame::OnRotation(wxCommandEvent &event) {
ChangeRotation((event.GetId() - wRot0)*90, true);
}
void DesmumeFrame::ChangeRotation(int rot, bool skip) {
wxSize sizeMin, sizeMax;
if (skip && rot == nds_screen_rotation_angle)
return;
SetMinSize(wxSize(-1,-1));
SetMaxSize(wxSize(-1,-1));
if (rot == 90 || rot == 270) {
SetClientSize(384 + nds_gap_size, 256);
sizeMax = sizeMin = ClientToWindowSize(wxSize(384,256));
sizeMax.IncBy(GAP_MAX,0);
} else {
SetClientSize(256, 384 + nds_gap_size);
sizeMax = sizeMin = ClientToWindowSize(wxSize(256,384));
sizeMax.IncBy(0,GAP_MAX);
}
SetMinSize(sizeMin);
SetMaxSize(sizeMax);
nds_screen_rotation_angle = rot;
}
void DesmumeFrame::onResize(wxSizeEvent &event) {
int w, h;
GetClientSize(&w,&h);
if (nds_screen_rotation_angle == 90 || nds_screen_rotation_angle == 270) {
if (w>=384)
nds_gap_size = w-384;
} else {
if (h>=384)
nds_gap_size = h-384;
}
event.Skip();
}
BEGIN_EVENT_TABLE(DesmumeFrame, wxFrame)
EVT_PAINT(DesmumeFrame::onPaint)
EVT_IDLE(DesmumeFrame::onIdle)
EVT_SIZE(DesmumeFrame::onResize)
EVT_CLOSE(DesmumeFrame::OnClose)
EVT_LEFT_DOWN(DesmumeFrame::OnTouchEvent)
EVT_LEFT_UP(DesmumeFrame::OnTouchEvent)
EVT_LEFT_DCLICK(DesmumeFrame::OnTouchEvent)
EVT_MOTION(DesmumeFrame::OnTouchEvent)
EVT_CLOSE(DesmumeFrame::OnClose)
EVT_MENU(wxID_EXIT, DesmumeFrame::OnQuit)
EVT_MENU(wxID_OPEN, DesmumeFrame::LoadRom)
EVT_MENU(wxID_ABOUT,DesmumeFrame::OnAbout)
@ -569,16 +620,16 @@ EVT_MENU(wSubmitABugReport,DesmumeFrame::submitABugReport)
EVT_MENU(wSaveStateAs,DesmumeFrame::saveStateAs)
EVT_MENU(wLoadStateFrom,DesmumeFrame::loadStateFrom)
EVT_MENU_RANGE(wSaveState01,wSaveState01+9,DesmumeFrame::Menu_SaveStates)
EVT_MENU_RANGE(wLoadState01,wLoadState01+9,DesmumeFrame::Menu_LoadStates)
EVT_MENU_RANGE(wSaveState01,wSaveState01+9,DesmumeFrame::Menu_SaveStates)
EVT_MENU_RANGE(wLoadState01,wLoadState01+9,DesmumeFrame::Menu_LoadStates)
EVT_MENU(wCloseRom,DesmumeFrame::closeRom)
EVT_MENU(wImportBackupMemory,DesmumeFrame::importBackupMemory)
EVT_MENU(wExportBackupMemory,DesmumeFrame::exportBackupMemory)
EVT_MENU_RANGE(wRot0,wRot270,DesmumeFrame::OnRotation)
EVT_MENU_RANGE(wRot0,wRot270,DesmumeFrame::OnRotation)
EVT_MENU(wSaveScreenshotAs,DesmumeFrame::saveScreenshotAs)
EVT_MENU(wQuickScreenshot,DesmumeFrame::quickScreenshot)
@ -591,8 +642,8 @@ EVT_MENU(w3dView,DesmumeFrame::_3dView)
EVT_MENU(wLuaWindow,DesmumeFrame::OnOpenLuaWindow)
EVT_MENU(wConfigureControls,DesmumeFrame::OnOpenControllerConfiguration)
EVT_MENU_RANGE(wxID_FILE1,wxID_FILE9,DesmumeFrame::OnOpenRecent)
EVT_MENU_RANGE(wxID_FILE1,wxID_FILE9,DesmumeFrame::OnOpenRecent)
END_EVENT_TABLE()
@ -601,28 +652,28 @@ IMPLEMENT_APP(Desmume)
static SPADInitialize PADInitialize;
void DesmumeFrame::NDSInitialize() {
NDS_FillDefaultFirmwareConfigData( &fw_config);
NDS_FillDefaultFirmwareConfigData( &fw_config);
#ifdef HAVE_LIBAGG
#ifdef HAVE_LIBAGG
Desmume_InitOnce();
aggDraw.hud->attach((u8*)GPU_screen, 256, 384, 1024);//TODO
#endif
#endif
//TODO
addon_type = NDS_ADDON_NONE;
addonsChangePak(addon_type);
#ifdef GDB_STUB
arm9_memio = &arm9_base_memory_iface;
arm7_memio = &arm7_base_memory_iface;
#ifdef GDB_STUB
arm9_memio = &arm9_base_memory_iface;
arm7_memio = &arm7_base_memory_iface;
NDS_Init( arm9_memio, &arm9_ctrl_iface,
arm7_memio, &arm7_ctrl_iface);
#else
NDS_Init();
arm7_memio, &arm7_ctrl_iface);
#else
NDS_Init();
#endif
#ifndef WIN32
SPU_ChangeSoundCore(SNDCORE_SDL, 735 * 4);
#endif
SPU_ChangeSoundCore(SNDCORE_SDL, 735 * 4);
#endif
NDS_3D_ChangeCore(0);
NDS_CreateDummyFirmware( &fw_config);
}
@ -639,9 +690,9 @@ bool Desmume::OnInit()
OpenConsole();
#endif
SetAppName(_T("desmume"));
wxConfigBase *pConfig = new wxFileConfig();
wxConfigBase::Set(pConfig);
SetAppName(_T("desmume"));
wxConfigBase *pConfig = new wxFileConfig();
wxConfigBase::Set(pConfig);
wxString emu_version(EMU_DESMUME_NAME_AND_VERSION(), wxConvUTF8);
DesmumeFrame *frame = new DesmumeFrame(emu_version);
frame->NDSInitialize();
@ -652,7 +703,7 @@ bool Desmume::OnInit()
#ifndef WIN32
extern void Initialize(void *init);
Initialize(&PADInitialize);
#endif
@ -663,20 +714,20 @@ DesmumeFrame::DesmumeFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title)
{
history = new wxFileHistory;
history = new wxFileHistory;
wxMenu *fileMenu = new wxMenu;
wxMenu *emulationMenu = new wxMenu;
wxMenu *viewMenu = new wxMenu;
wxMenu *configMenu = new wxMenu;
wxMenu *toolsMenu = new wxMenu;
wxMenu *helpMenu = new wxMenu;
wxMenu *saves(MakeStatesSubMenu(wSaveState01));
wxMenu *loads(MakeStatesSubMenu(wLoadState01));
wxMenu *recentMenu = new wxMenu;
history->UseMenu(recentMenu);
wxMenu *saves(MakeStatesSubMenu(wSaveState01));
wxMenu *loads(MakeStatesSubMenu(wLoadState01));
wxMenu *recentMenu = new wxMenu;
history->UseMenu(recentMenu);
fileMenu->Append(wxID_OPEN, _T("Load R&om\tAlt-R"));
fileMenu->AppendSubMenu(recentMenu, _T("Recent files"));
fileMenu->AppendSubMenu(recentMenu, _T("Recent files"));
fileMenu->Append(wCloseRom, _T("Close Rom"));
fileMenu->AppendSeparator();
fileMenu->Append(wSaveStateAs, _T("Save State As..."));
@ -701,14 +752,14 @@ DesmumeFrame::DesmumeFrame(const wxString& title)
emulationMenu->Append(wPause, _T("&Pause\tAlt-P"), _T("Pause Emulation"));
emulationMenu->Append(wReset, _T("&Reset\tAlt-R"), _T("Reset Emulation"));
wxMenu *rotateMenu = new wxMenu;
{
rotateMenu->AppendRadioItem(wRot0, _T("0"));
rotateMenu->AppendRadioItem(wRot90, _T("90"));
rotateMenu->AppendRadioItem(wRot180, _T("180"));
rotateMenu->AppendRadioItem(wRot270, _T("270"));
}
viewMenu->AppendSubMenu(rotateMenu, _T("Rotate"));
wxMenu *rotateMenu = new wxMenu;
{
rotateMenu->AppendRadioItem(wRot0, _T("0"));
rotateMenu->AppendRadioItem(wRot90, _T("90"));
rotateMenu->AppendRadioItem(wRot180, _T("180"));
rotateMenu->AppendRadioItem(wRot270, _T("270"));
}
viewMenu->AppendSubMenu(rotateMenu, _T("Rotate"));
viewMenu->AppendSeparator();
viewMenu->AppendCheckItem(wFrameCounter, _T("&Display Frame Counter"));
viewMenu->AppendCheckItem(wFPS, _T("&Display FPS"));
@ -721,26 +772,26 @@ DesmumeFrame::DesmumeFrame(const wxString& title)
wxMenu *layersMenu = new wxMenu;
{
layersMenu->AppendCheckItem(wMainGPU, _T("Main GPU"));
layersMenu->Check(wMainGPU, true);
layersMenu->Check(wMainGPU, true);
layersMenu->AppendCheckItem(wMainBG0, _T("Main BG 0"));
layersMenu->Check(wMainBG0, true);
layersMenu->Check(wMainBG0, true);
layersMenu->AppendCheckItem(wMainBG1, _T("Main BG 1"));
layersMenu->Check(wMainBG1, true);
layersMenu->Check(wMainBG1, true);
layersMenu->AppendCheckItem(wMainBG2, _T("Main BG 2"));
layersMenu->Check(wMainBG2, true);
layersMenu->Check(wMainBG2, true);
layersMenu->AppendCheckItem(wMainBG3, _T("Main BG 3"));
layersMenu->Check(wMainBG3, true);
layersMenu->Check(wMainBG3, true);
layersMenu->AppendSeparator();
layersMenu->AppendCheckItem(wSubGPU, _T("Sub GPU"));
layersMenu->Check(wSubGPU, true);
layersMenu->Check(wSubGPU, true);
layersMenu->AppendCheckItem(wSubBG0, _T("Sub BG 0"));
layersMenu->Check(wSubBG0, true);
layersMenu->Check(wSubBG0, true);
layersMenu->AppendCheckItem(wSubBG1, _T("Sub BG 1"));
layersMenu->Check(wSubBG1, true);
layersMenu->Check(wSubBG1, true);
layersMenu->AppendCheckItem(wSubBG2, _T("Sub BG 2"));
layersMenu->Check(wSubBG2, true);
layersMenu->Check(wSubBG2, true);
layersMenu->AppendCheckItem(wSubBG3, _T("Sub BG 3"));
layersMenu->Check(wSubBG3, true);
layersMenu->Check(wSubBG3, true);
}
configMenu->Append(wConfigureControls, _T("Controls"));
@ -764,9 +815,9 @@ DesmumeFrame::DesmumeFrame(const wxString& title)
// CreateStatusBar(2);
// SetStatusText("Welcome to Desmume!");
LoadSettings();
rotateMenu->Check(wRot0+(nds_screen_rotation_angle/90), true);
ChangeRotation(nds_screen_rotation_angle, false);
LoadSettings();
rotateMenu->Check(wRot0+(nds_screen_rotation_angle/90), true);
ChangeRotation(nds_screen_rotation_angle, false);
}
#ifdef WIN32
@ -786,29 +837,29 @@ createThread_gdb( void (APIENTRY *thread_function)( void *data),
void
joinThread_gdb( void *thread_handle) {
}
#endif
bool DesmumeFrame::LoadSettings() {
wxConfigBase::Get()->Read(_T("/Screen/Gap"),&nds_gap_size,0);
wxConfigBase::Get()->Read(_T("/Screen/Rotation"),&nds_screen_rotation_angle,0);
wxConfigBase::Get()->SetPath(_T("/History"));
history->Load(*wxConfigBase::Get());
return true;
}
bool DesmumeFrame::SaveSettings() {
wxConfigBase::Get()->Write(_T("/Screen/Gap"),nds_gap_size);
wxConfigBase::Get()->Write(_T("/Screen/Rotation"),nds_screen_rotation_angle);
wxConfigBase::Get()->SetPath(_T("/History"));
history->Save(*wxConfigBase::Get());
return true;
}
void DesmumeFrame::OnClose(wxCloseEvent &event) {
SaveSettings();
event.Skip();
}
void DesmumeFrame::OnOpenRecent(wxCommandEvent &event) {
#endif
bool DesmumeFrame::LoadSettings() {
wxConfigBase::Get()->Read(_T("/Screen/Gap"),&nds_gap_size,0);
wxConfigBase::Get()->Read(_T("/Screen/Rotation"),&nds_screen_rotation_angle,0);
wxConfigBase::Get()->SetPath(_T("/History"));
history->Load(*wxConfigBase::Get());
return true;
}
bool DesmumeFrame::SaveSettings() {
wxConfigBase::Get()->Write(_T("/Screen/Gap"),nds_gap_size);
wxConfigBase::Get()->Write(_T("/Screen/Rotation"),nds_screen_rotation_angle);
wxConfigBase::Get()->SetPath(_T("/History"));
history->Save(*wxConfigBase::Get());
return true;
}
void DesmumeFrame::OnClose(wxCloseEvent &event) {
SaveSettings();
event.Skip();
}
void DesmumeFrame::OnOpenRecent(wxCommandEvent &event) {
execute = true;
NDS_LoadROM(history->GetHistoryFile(event.GetId()-wxID_FILE1).mb_str(),NULL);
}
NDS_LoadROM(history->GetHistoryFile(event.GetId()-wxID_FILE1).mb_str(),NULL);
}