Compare commits

...

21 Commits

Author SHA1 Message Date
gocha
b2188ebd3a 0.9.7: Lua: fix a bug that gui.gdscreenshot() always returns a transparent image. it will always return a complete opaque image from now. 2012-12-28 09:19:30 +00:00
gocha
900c6d0a94 0.9.7: Fix ARM9 intrWaitARM_state save/load 2012-08-26 03:54:04 +00:00
gocha
7c56766d15 RAM Search: Force updating Current Value when field size gets increased.
The same fix needs to be applied to Previous Value as well. That hasn't been done this time yet.
2011-05-07 05:53:22 +00:00
riccardom
a09686238d Backport cocoa updates from trunk up to r3993
Thanks again Rogerman!
2011-04-30 15:01:48 +00:00
riccardom
6b9d89e6b6 Backport r3971, r3974, r3975 from trunk
To be able to build the cocoa frontend.
2011-04-30 14:59:50 +00:00
gocha
9faea35458 RAM Search: fix reset code and update the current values for every addresses.
RAM Search: workaround for auto search restart.

As usual, I need to apply the same fix to every emulators, that uses the same RAM Search code.
2011-03-21 00:02:23 +00:00
gocha
9f31c63d7a Unpatch r3909. 2011-02-06 05:17:59 +00:00
gocha
1fb85a8180 Import some fixes/improvements from trunk.
r3879: OpenGL: add support quad primitives
r3880: win32: add 5x window size
r3881: add big endian toggle to memview
r3889, r3891, r3893, r3895, r3909: line poly rendering
r3902: win32: allow debug console showage to be overridden with ini file [Display] Show Console=1
r3903: clear lag frame on 8 and 32bit keypad register reads
r3916: Lua - fix memory.readdword function (was returning signed values), same fix as r296 of GENS
2011-02-06 03:07:20 +00:00
zeromus
bb5a398d6f 64bit gtk fixes failed to merge. why?? 2011-02-04 20:43:29 +00:00
adelikat
c21ce0663b 9.7 branc - Lua - fix memory.readdword function (was returning signed values), same fix as r296 of GENS 2011-01-31 15:18:28 +00:00
adelikat
355d02eab5 change 9.7 branch version to 9.7 2010-11-20 04:32:33 +00:00
zeromus
39ec3fa31d port fixed changelog 2010-11-18 03:03:39 +00:00
zeromus
74bd6c30c1 etc 2010-11-18 02:36:55 +00:00
zeromus
0b2402ee94 port r3855 to release branch; as per usual this for some reason necessitates touching 6000 files for no good reason 2010-11-17 07:33:44 +00:00
gocha
56df1af657 0.9.7: Lua delayload & menu API 2010-11-06 23:51:11 +00:00
zeromus
4064a2f4ca merge 3843 from trunk 2010-11-05 06:28:28 +00:00
gocha
048cd520c3 ramwatch: oops, "new" button must be always active 2010-10-30 06:50:17 +00:00
zeromus
ef4e0ac269 merge 3825-3862 from trunk 2010-10-27 04:59:56 +00:00
zeromus
79bd9ae0c1 merge 3814-3816, 3819-3822, 3824, 3831, 3832 to release branch 2010-10-27 01:48:02 +00:00
riccardom
c68d27e738 Remember to unref drawPixbuf
Backport r3823 from trunk.
2010-10-25 16:17:04 +00:00
zeromus
d8855117b3 097 release branch 2010-10-07 21:02:48 +00:00
60 changed files with 2736 additions and 1722 deletions

View File

@@ -13,7 +13,7 @@ General/Core:
bug: rewrite IPC/GX FIFO, IRQ flag generation, and wait-for-IRQ logics
bug: rewrite RTC calendar handling; now supports years > 2038
enh: auto-DLDI patching for homebrew
enh: --gbaslot=self mounts self.nds in slot2
enh: --gbaslot-rom=self mounts self.nds in slot2
enh: more realistic exception handling
enh: piano controller emulation
enh: modular slot-1 system for exact emulation of homebrew cards

1
desmume/confosx Executable file
View File

@@ -0,0 +1 @@
./configure CFLAGS="-arch i386" CXXFLAGS="-arch i386"

View File

@@ -196,6 +196,12 @@ void GPU_Reset(GPU *g, u8 l)
{
memset(g, 0, sizeof(GPU));
//important for emulator stability for this to initialize, since we have to setup a table based on it
g->BLDALPHA_EVA = 0;
g->BLDALPHA_EVB = 0;
//make sure we have our blend table setup even if the game blends without setting the blend variables
g->updateBLDALPHA();
g->setFinalColorBck_funcNum = 0;
g->setFinalColor3d_funcNum = 0;
g->setFinalColorSpr_funcNum = 0;

View File

@@ -1650,7 +1650,7 @@ bool DmaController::loadstate(EMUFILE* f)
read8le(&temp,f); sar = (EDMASourceUpdate)temp;
read8le(&temp,f); dar = (EDMADestinationUpdate)temp;
read32le(&saddr,f); read32le(&daddr,f);
read32le(&check,f); read32le(&running,f); read32le(&paused,f); read32le(&triggered,f);
read32le(&dmaCheck,f); read32le(&running,f); read32le(&paused,f); read32le(&triggered,f);
read64le(&nextEvent,f);
if(version==1)
@@ -1673,7 +1673,7 @@ void DmaController::savestate(EMUFILE *f)
write8le(sar,f);
write8le(dar,f);
write32le(saddr,f); write32le(daddr,f);
write32le(check,f); write32le(running,f); write32le(paused,f); write32le(triggered,f);
write32le(dmaCheck,f); write32le(running,f); write32le(paused,f); write32le(triggered,f);
write64le(nextEvent,f);
write32le(saddr_user,f);
write32le(daddr_user,f);
@@ -1761,7 +1761,7 @@ if(_startmode==0 && wordcount==1) {
void DmaController::exec()
{
check = FALSE;
dmaCheck = FALSE;
if(running)
{
@@ -1947,7 +1947,7 @@ void DmaController::tryTrigger(EDMAMode mode)
void DmaController::doSchedule()
{
check = TRUE;
dmaCheck = TRUE;
nextEvent = nds_timer;
NDS_RescheduleDMA();
}
@@ -3237,6 +3237,10 @@ u8 FASTCALL _MMU_ARM9_read08(u32 adr)
case REG_DISPA_DISP3DCNT+1: return readreg_DISP3DCNT(8,adr);
case REG_DISPA_DISP3DCNT+2: return readreg_DISP3DCNT(8,adr);
case REG_DISPA_DISP3DCNT+3: return readreg_DISP3DCNT(8,adr);
case REG_KEYINPUT:
LagFrameFlag=0;
break;
}
}
@@ -3318,9 +3322,7 @@ u16 FASTCALL _MMU_ARM9_read16(u32 adr)
case REG_DISPA_DISP3DCNT: return readreg_DISP3DCNT(16,adr);
case REG_DISPA_DISP3DCNT+2: return readreg_DISP3DCNT(16,adr);
case 0x04000130:
case 0x04000136:
//not sure whether these should trigger from byte reads
case REG_KEYINPUT:
LagFrameFlag=0;
break;
@@ -3449,8 +3451,12 @@ u32 FASTCALL _MMU_ARM9_read32(u32 adr)
}
case REG_GCDATAIN: return MMU_readFromGC<ARMCPU_ARM9>();
case REG_POWCNT1: return readreg_POWCNT1(32,adr);
case REG_POWCNT1: return readreg_POWCNT1(32,adr);
case REG_DISPA_DISP3DCNT: return readreg_DISP3DCNT(32,adr);
case REG_KEYINPUT:
LagFrameFlag=0;
break;
}
return T1ReadLong_guaranteedAligned(MMU.MMU_MEM[ARMCPU_ARM9][adr>>20], adr & MMU.MMU_MASK[ARMCPU_ARM9][adr>>20]);
}

View File

@@ -204,7 +204,7 @@ public:
u32 saddr_user, daddr_user;
//indicates whether the dma needs to be checked for triggering
BOOL check;
BOOL dmaCheck;
//indicates whether the dma right now is logically running
//(though for now we copy all the data when it triggers)
@@ -239,7 +239,7 @@ public:
//by inspecting dma3 saddr when it boots
saddr(0), daddr(0),
saddr_user(0), daddr_user(0),
check(FALSE),
dmaCheck(FALSE),
running(FALSE),
paused(FALSE),
triggered(FALSE),

View File

@@ -74,7 +74,6 @@ libdesmume_a_SOURCES = \
utils/libfat/lock.cpp \
utils/libfat/lock.h \
utils/libfat/mem_allocate.h \
utils/libfat/ndstypes.h \
utils/libfat/partition.cpp \
utils/libfat/partition.h \
addons.cpp addons.h \

View File

@@ -1183,11 +1183,11 @@ template<int procnum, int chan> struct TSequenceItem_DMA : public TSequenceItem
FORCEINLINE bool isTriggered()
{
return (controller->check && nds_timer>= controller->nextEvent);
return (controller->dmaCheck && nds_timer>= controller->nextEvent);
}
FORCEINLINE bool isEnabled() {
return controller->check?TRUE:FALSE;
return controller->dmaCheck?TRUE:FALSE;
}
FORCEINLINE u64 next()
@@ -2640,6 +2640,7 @@ void NDS_setTouchPos(u16 x, u16 y)
}
#ifndef WIN32
#ifndef DESMUME_COCOA
// FIXME: this code should be deleted from here,
// other platforms should call NDS_beginProcessingInput,NDS_endProcessingInput once per frame instead
// (see the function called "StepRunLoop_Core" in src/windows/main.cpp),
@@ -2649,6 +2650,7 @@ void NDS_setTouchPos(u16 x, u16 y)
nds.isTouch = 1;
MMU.ARM7_REG[0x136] &= 0xBF;
#endif
#endif
}
void NDS_releaseTouch(void)
{
@@ -2658,6 +2660,7 @@ void NDS_releaseTouch(void)
rawUserInput.touch.isTouch = false;
#ifndef WIN32
#ifndef DESMUME_COCOA
// FIXME: this code should be deleted from here,
// other platforms should call NDS_beginProcessingInput,NDS_endProcessingInput once per frame instead
// (see the function called "StepRunLoop_Core" in src/windows/main.cpp),
@@ -2667,6 +2670,7 @@ void NDS_releaseTouch(void)
nds.isTouch = 0;
MMU.ARM7_REG[0x136] |= 0x40;
#endif
#endif
}
void NDS_setMic(bool pressed)
{

View File

@@ -30,6 +30,8 @@
#include "OGLRender.h"
#include "debug.h"
CACHE_ALIGN float material_8bit_to_float[255] = {0};
bool (*oglrender_init)() = 0;
bool (*oglrender_beginOpenGL)() = 0;
void (*oglrender_endOpenGL)() = 0;
@@ -400,6 +402,9 @@ static char OGLInit(void)
if(!BEGINGL())
return 0;
for (u8 i = 0; i < 255; i++)
material_8bit_to_float[i] = (float)(i<<2)/255.f;
expandFreeTextures();
glPixelStorei(GL_PACK_ALIGNMENT,8);
@@ -879,40 +884,6 @@ static void OGLRender()
BeginRenderPoly();
}
//since we havent got the whole pipeline working yet, lets use opengl for the projection
/* if(lastProjIndex != poly->projIndex) {
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(gfx3d.projlist->projMatrix[poly->projIndex]);
lastProjIndex = poly->projIndex;
}*/
/* glBegin(type==3?GL_TRIANGLES:GL_QUADS);
for(int j=0;j<type;j++) {
VERT* vert = &gfx3d.vertlist->list[poly->vertIndexes[j]];
u8 color[4] = {
material_5bit_to_8bit[vert->color[0]],
material_5bit_to_8bit[vert->color[1]],
material_5bit_to_8bit[vert->color[2]],
material_5bit_to_8bit[vert->color[3]]
};
//float tempCoord[4];
//Vector4Copy(tempCoord, vert->coord);
//we havent got the whole pipeline working yet, so we cant do this
////convert from ds device coords to opengl
//tempCoord[0] *= 2;
//tempCoord[1] *= 2;
//tempCoord[0] -= 1;
//tempCoord[1] -= 1;
//todo - edge flag?
glTexCoord2fv(vert->texcoord);
glColor4ubv((GLubyte*)color);
//glVertex4fv(tempCoord);
glVertex4fv(vert->coord);
}
glEnd();*/
if(lastViewport != poly->viewport)
{
VIEWPORT viewport;
@@ -921,50 +892,26 @@ static void OGLRender()
lastViewport = poly->viewport;
}
glBegin(GL_TRIANGLES);
VERT *vert0 = &gfx3d.vertlist->list[poly->vertIndexes[0]];
float alpha = poly->getAlpha()/31.0f;
if(wireframe) alpha = 1.0;
float color0[4] = {
(vert0->color[0]<<2)/255.0f,
(vert0->color[1]<<2)/255.0f,
(vert0->color[2]<<2)/255.0f,
alpha
};
//this draws things as a fan to prepare for the day when the clipping is done in gfx3d
//and funny shaped polys find their way into here.
//of course it could really be drawn as a fan, i suppose.. i dont remember why we did it this way
for(int j = 1; j < (type-1); j++)
if (gfx3d_IsLinePoly(poly))
glBegin(GL_LINE_LOOP);
else if (type == 4)
glBegin(GL_QUADS);
else
glBegin(GL_TRIANGLES);
for(int j = 0; j < type; j++)
{
VERT *vert1 = &gfx3d.vertlist->list[poly->vertIndexes[j]];
VERT *vert2 = &gfx3d.vertlist->list[poly->vertIndexes[j+1]];
VERT *vert = &gfx3d.vertlist->list[poly->vertIndexes[j]];
float color1[4] = {
(vert1->color[0]<<2)/255.0f,
(vert1->color[1]<<2)/255.0f,
(vert1->color[2]<<2)/255.0f,
alpha
};
float color2[4] = {
(vert2->color[0]<<2)/255.0f,
(vert2->color[1]<<2)/255.0f,
(vert2->color[2]<<2)/255.0f,
alpha
};
glTexCoord2fv(vert0->texcoord);
glColor4fv((GLfloat*)color0);
glVertex4fv(vert0->coord);
glTexCoord2fv(vert1->texcoord);
glColor4fv((GLfloat*)color1);
glVertex4fv(vert1->coord);
glTexCoord2fv(vert2->texcoord);
glColor4fv((GLfloat*)color2);
glVertex4fv(vert2->coord);
glTexCoord2fv(vert->texcoord);
glColor4f(material_8bit_to_float[vert->color[0]],
material_8bit_to_float[vert->color[1]],
material_8bit_to_float[vert->color[2]],
alpha);
glVertex4fv(vert->coord);
}
glEnd();

View File

@@ -215,8 +215,6 @@ void armcpu_t::changeCPSR()
void armcpu_init(armcpu_t *armcpu, u32 adr)
{
u32 i;
armcpu->LDTBit = (armcpu->proc_ID==0); //Si ARM9 utiliser le syte v5 pour le load
armcpu->intVector = 0xFFFF0000 * (armcpu->proc_ID==0);
armcpu->waitIRQ = FALSE;
@@ -227,12 +225,12 @@ void armcpu_init(armcpu_t *armcpu, u32 adr)
// armcpu->irq_flag = 0;
//#endif
for(i = 0; i < 15; ++i)
for(int i = 0; i < 16; ++i)
{
armcpu->R[i] = 0;
if(armcpu->coproc[i]) free(armcpu->coproc[i]);
armcpu->coproc[i] = NULL;
}
}
armcpu->CPSR.val = armcpu->SPSR.val = SYS;

View File

@@ -420,11 +420,11 @@ BOOL CHEATS::XXcodePreParser(CHEATS_LIST *list, char *code)
count = (strlen(tmp_buf) / 16);
for (int i=0; i < count; i++)
{
char buf[8] = {0};
strncpy(buf, tmp_buf+(i*16), 8);
sscanf_s(buf, "%x", &list->code[i][0]);
strncpy(buf, tmp_buf+(i*16) + 8, 8);
sscanf_s(buf, "%x", &list->code[i][1]);
char buf[9] = {0};
memcpy(buf, tmp_buf+(i*16), 8);
sscanf(buf, "%x", &list->code[i][0]);
memcpy(buf, tmp_buf+(i*16) + 8, 8);
sscanf(buf, "%x", &list->code[i][1]);
}
list->num = count;

File diff suppressed because it is too large Load Diff

View File

@@ -14,10 +14,26 @@
<key>CFBundleTypeIconFile</key>
<string>DeSmuME</string>
<key>CFBundleTypeName</key>
<string>Nintendo DS Software</string>
<string>Nintendo DS ROM</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>dst</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>DeSmuME</string>
<key>CFBundleTypeName</key>
<string>DeSmuME Save State</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>DeSmuME</string>
@@ -32,11 +48,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.9.3</string>
<string>0.9.7</string>
<key>CFBundleSignature</key>
<string>????</string>
<string>DSmM</string>
<key>CFBundleVersion</key>
<string>0.9.3</string>
<string>0.9.7</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>

Binary file not shown.

View File

@@ -19,6 +19,20 @@
#import "globals.h"
#define STRING_DESMUME_WEBSITE "http://www.desmume.org"
#define STRING_DESMUME_FORUM_SITE "http://forums.desmume.org/index.php"
#define STRING_DESMUME_BUG_SITE "http://sourceforge.net/tracker/?group_id=164579&atid=832291"
#define STRING_FILENAME_README "README"
#define STRING_FILENAME_COPYING "COPYING"
#define STRING_FILENAME_AUTHORS "AUTHORS"
#define STRING_FILENAME_CHANGELOG "ChangeLog"
#define STRING_TABLABEL_README "Read Me"
#define STRING_TABLABEL_LICENSE "License"
#define STRING_TABLABEL_AUTHORS "Authors"
#define STRING_TABLABEL_CHANGELOG "Change Log"
const CGFloat inner_padding = 3;
const CGFloat outer_padding = 3;
const CGFloat tab_view_height = 240;
@@ -36,6 +50,8 @@ NSTextField *about_website;
}
- (void)windowDidResize:(NSNotification*)notification;
- (void)windowWillClose:(NSNotification*)notification;
+ (void) readTextFile:(NSString *)dataPath label:(NSString *)labelName tab:(NSTabView *)tabView;
@end
@implementation AboutDelegate
@@ -77,23 +93,52 @@ NSTextField *about_website;
//end our modal session if the about window closses
[NSApp stopModal];
}
+ (void) readTextFile:(NSString *)dataPath label:(NSString *)labelName tab:(NSTabView *)tabView
{
NSRect rect;
rect.origin.x = rect.origin.y = 0;
NSTabViewItem *tab_view_item = [[NSTabViewItem alloc] initWithIdentifier:nil];
[tab_view_item setLabel:labelName];
[tabView addTabViewItem:tab_view_item];
NSScrollView *scroll_view = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
[scroll_view setDrawsBackground:NO];
[scroll_view setHasVerticalScroller:YES];
[scroll_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[tab_view_item setView:scroll_view];
rect.size = [[scroll_view contentView] frame].size;
NSTextView *text_view = [[NSTextView alloc] initWithFrame:rect];
[text_view insertText:[NSString stringWithContentsOfFile:dataPath encoding:NSASCIIStringEncoding error:NULL]];
[text_view setDrawsBackground:NO];
[text_view setEditable:NO];
[text_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[scroll_view setDocumentView:text_view];
[text_view release];
[scroll_view release];
[tab_view_item release];
}
@end
@implementation NSApplication (helpmenu)
- (void)launchWebsite
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://desmume.sourceforge.net"]];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@STRING_DESMUME_WEBSITE]];
}
- (void)launchForums
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://forums.desmume.org/index.php"]];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@STRING_DESMUME_FORUM_SITE]];
}
- (void)bugReport
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://sourceforge.net/tracker/?func=add&group_id=164579&atid=832291"]];
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@STRING_DESMUME_BUG_SITE]];
}
@end
@@ -201,7 +246,7 @@ NSTextField *about_website;
//
about_website = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 8 + tab_view_height + inner_padding, width, 17)];
[about_website setStringValue:@"http://www.desmume.org"];//fixme linkize
[about_website setStringValue:@STRING_DESMUME_WEBSITE];//fixme linkize
[about_website setEditable:NO];
[about_website setDrawsBackground:NO];
[about_website setBordered:NO];
@@ -221,126 +266,33 @@ NSTextField *about_website;
NSTabView *tab_view = [[NSTabView alloc] initWithFrame:NSMakeRect(outer_padding, outer_padding, window_width - outer_padding*2, tab_view_height)];
[tab_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[[about_window contentView] addSubview:tab_view];
NSRect rect;
rect.origin.x = rect.origin.y = 0;
//fixme if one of the files we read from is missing the entire panel doesn't show
NSTabViewItem *tab_view_item;
NSScrollView *scroll_view;
NSTextView *text_view;
//README
NSString *datapath = [main_bundle pathForResource:@"README" ofType:@""];
NSString *datapath = [main_bundle pathForResource:@STRING_FILENAME_README ofType:@""];
if(datapath != nil)
{
tab_view_item = [[NSTabViewItem alloc] initWithIdentifier:nil];
[tab_view_item setLabel:NSLocalizedString(@"Readme", nil)];
[tab_view addTabViewItem:tab_view_item];
scroll_view = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
[scroll_view setDrawsBackground:NO];
[scroll_view setHasVerticalScroller:YES];
[scroll_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[tab_view_item setView:scroll_view];
rect.size = [[scroll_view contentView] frame].size;
text_view = [[NSTextView alloc] initWithFrame:rect];
[text_view insertText:[NSString stringWithContentsOfFile:datapath]];
[text_view setDrawsBackground:NO];
[text_view setEditable:NO];
[text_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[scroll_view setDocumentView:text_view];
[text_view release];
[scroll_view release];
[tab_view_item release];
[AboutDelegate readTextFile:datapath label:NSLocalizedString(@STRING_TABLABEL_README, nil) tab:tab_view];
}
//LICENSE
datapath = [main_bundle pathForResource:@"COPYING" ofType:@""];
datapath = [main_bundle pathForResource:@STRING_FILENAME_COPYING ofType:@""];
if(datapath != nil)
{
tab_view_item = [[NSTabViewItem alloc] initWithIdentifier:nil];
[tab_view_item setLabel:NSLocalizedString(@"License", nil)];
[tab_view addTabViewItem:tab_view_item];
scroll_view = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
[scroll_view setDrawsBackground:NO];
[scroll_view setHasVerticalScroller:YES];
[scroll_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[tab_view_item setView:scroll_view];
rect.size = [[scroll_view contentView] frame].size;
text_view = [[NSTextView alloc] initWithFrame:rect];
[text_view insertText:[NSString stringWithContentsOfFile:datapath]];
[text_view setDrawsBackground:NO];
[text_view setEditable:NO];
[text_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[scroll_view setDocumentView:text_view];
[text_view release];
[scroll_view release];
[tab_view_item release];
[AboutDelegate readTextFile:datapath label:NSLocalizedString(@STRING_TABLABEL_LICENSE, nil) tab:tab_view];
}
//AUTHORS
datapath = [main_bundle pathForResource:@"AUTHORS" ofType:@""];
datapath = [main_bundle pathForResource:@STRING_FILENAME_AUTHORS ofType:@""];
if(datapath != nil)
{
tab_view_item = [[NSTabViewItem alloc] initWithIdentifier:nil];
[tab_view_item setLabel:NSLocalizedString(@"Authors", nil)];
[tab_view addTabViewItem:tab_view_item];
scroll_view = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
[scroll_view setDrawsBackground:NO];
[scroll_view setHasVerticalScroller:YES];
[scroll_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[tab_view_item setView:scroll_view];
rect.size = [[scroll_view contentView] frame].size;
text_view = [[NSTextView alloc] initWithFrame:rect];
[text_view insertText:[NSString stringWithContentsOfFile:datapath]];
[text_view setDrawsBackground:NO];
[text_view setEditable:NO];
[text_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[scroll_view setDocumentView:text_view];
[text_view release];
[scroll_view release];
[tab_view_item release];
[AboutDelegate readTextFile:datapath label:NSLocalizedString(@STRING_TABLABEL_AUTHORS, nil) tab:tab_view];
}
//CHANGE LOG
datapath = [main_bundle pathForResource:@"ChangeLog" ofType:@""];
datapath = [main_bundle pathForResource:@STRING_FILENAME_CHANGELOG ofType:@""];
if(datapath != nil)
{
tab_view_item = [[NSTabViewItem alloc] initWithIdentifier:nil];
[tab_view_item setLabel:NSLocalizedString(@"Change Log", nil)];
[tab_view addTabViewItem:tab_view_item];
scroll_view = [[NSScrollView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
[scroll_view setDrawsBackground:NO];
[scroll_view setHasVerticalScroller:YES];
[scroll_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[tab_view_item setView:scroll_view];
rect.size = [[scroll_view contentView] frame].size;
text_view = [[NSTextView alloc] initWithFrame:rect];
[text_view insertText:[NSString stringWithContentsOfFile:datapath]];
[text_view setDrawsBackground:NO];
[text_view setEditable:NO];
[text_view setAutoresizingMask:NSViewWidthSizable|NSViewHeightSizable];
[scroll_view setDocumentView:text_view];
[text_view release];
[scroll_view release];
[tab_view_item release];
[AboutDelegate readTextFile:datapath label:NSLocalizedString(@STRING_TABLABEL_CHANGELOG, nil) tab:tab_view];
}
//
@@ -348,9 +300,9 @@ NSTextField *about_website;
content_min_width = [tab_view minimumSize].width;
[tab_view release];
//show the window
rect = [about_window frame];
NSRect rect = [about_window frame];
if(rect.size.width < content_min_width + outer_padding*2)
rect.size.width = content_min_width + outer_padding*2;
[about_window setFrame:rect display:NO];

View File

@@ -58,3 +58,110 @@ NSString* openDialog(NSArray *file_types)
return NULL;
}
BOOL CreateAppDirectory(NSString *directoryName)
{
BOOL result = NO;
BOOL isDir = YES;
NSString *tempPath = nil;
NSString *appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
NSArray *savePaths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
if ([savePaths count] > 0)
{
tempPath = [savePaths objectAtIndex:0];
}
else
{
return result;
}
NSFileManager *fileManager = [[NSFileManager alloc] init];
/*
Mac OS X v10.4 only
Code for creating new directories based on NSString paths.
*/
tempPath = [[tempPath stringByAppendingString:@"/"] stringByAppendingString:appName];
result = [fileManager createDirectoryAtPath:tempPath attributes:nil];
if (result == NO)
{
if([fileManager fileExistsAtPath:tempPath isDirectory:&isDir] == NO)
{
[fileManager release];
return result;
}
}
tempPath = [[tempPath stringByAppendingString:@"/"] stringByAppendingString:appVersion];
result = [fileManager createDirectoryAtPath:tempPath attributes:nil];
if (result == NO)
{
if([fileManager fileExistsAtPath:tempPath isDirectory:&isDir] == NO)
{
[fileManager release];
return result;
}
}
if (directoryName != nil)
{
tempPath = [[tempPath stringByAppendingString:@"/"] stringByAppendingString:directoryName];
result = [fileManager createDirectoryAtPath:tempPath attributes:nil];
if (result == NO)
{
if([fileManager fileExistsAtPath:tempPath isDirectory:&isDir] == NO)
{
[fileManager release];
return result;
}
}
}
/*
In Mac OS X v10.4, having the File Manager create new directories where they already exist
returns NO. Note that this behavior is not per Apple's own documentation. Therefore, we manually
set result=YES at the end to make sure the function returns the right result.
*/
result = YES;
/*
Mac OS X v10.5 and later
Yes, it's that simple...
*/
//result = [fileManager createDirectoryAtPath:savePath createIntermediates:YES attributes:nil error:NULL];
[fileManager release];
return result;
}
NSString* GetPathUserAppSupport(NSString *directoryName)
{
NSString *userAppSupportPath = nil;
NSString *appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
NSArray *savePaths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
if ([savePaths count] > 0)
{
userAppSupportPath = [savePaths objectAtIndex:0];
}
else
{
return userAppSupportPath;
}
if (directoryName == nil)
{
userAppSupportPath = [[[[userAppSupportPath stringByAppendingString:@"/"] stringByAppendingString:appName] stringByAppendingString:@"/"] stringByAppendingString:appVersion];
}
else
{
userAppSupportPath = [[[[[[userAppSupportPath stringByAppendingString:@"/"] stringByAppendingString:appName] stringByAppendingString:@"/"] stringByAppendingString:appVersion] stringByAppendingString:@"/"] stringByAppendingString:directoryName];
}
return userAppSupportPath;
}

View File

@@ -27,6 +27,8 @@ extern "C"
void messageDialog(NSString *title, NSString *text);
BOOL messageDialogYN(NSString *title, NSString *text);
NSString* openDialog(NSArray *file_types);
BOOL CreateAppDirectory(NSString *directoryName);
NSString* GetPathUserAppSupport(NSString *directoryName);
//
#if !defined(__LP64__) && !defined(NS_BUILD_32_LIKE_64)
@@ -34,7 +36,15 @@ typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
typedef float CGFloat;
// Taken from CIVector.h of the Mac OS X 10.5 SDK.
// Defines CGFloat for Mac OS X 10.4 and earlier.
#ifndef CGFLOAT_DEFINED
typedef float CGFloat;
# define CGFLOAT_MIN FLT_MIN
# define CGFLOAT_MAX FLT_MAX
# define CGFLOAT_IS_DOUBLE 0
# define CGFLOAT_DEFINED 1
#endif
#ifdef __cplusplus
}

View File

@@ -25,11 +25,13 @@
*/
@class VideoOutputWindow;
@class CocoaDSController;
@interface InputHandler : NSResponder
{
@private
VideoOutputWindow *my_ds;
CocoaDSController *dsController;
}
//preferences
+ (NSView*)createPreferencesView:(float)width;

View File

@@ -166,12 +166,14 @@ inline int testKey(NSString *chars_pressed, NSString *chars_for_key)
my_ds = nds;
[my_ds retain];
dsController = [nds getDSController];
[dsController retain];
return self;
}
- (void)dealloc
{
[my_ds release];
[super dealloc];
}
@@ -182,18 +184,18 @@ inline int testKey(NSString *chars_pressed, NSString *chars_for_key)
NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
NSString *chars = [event characters];
if(testKey(chars, [settings stringForKey:PREF_KEY_A ]))[my_ds pressA];
else if(testKey(chars, [settings stringForKey:PREF_KEY_B ]))[my_ds pressB];
else if(testKey(chars, [settings stringForKey:PREF_KEY_SELECT]))[my_ds pressSelect];
else if(testKey(chars, [settings stringForKey:PREF_KEY_START ]))[my_ds pressStart];
else if(testKey(chars, [settings stringForKey:PREF_KEY_RIGHT ]))[my_ds pressRight];
else if(testKey(chars, [settings stringForKey:PREF_KEY_LEFT ]))[my_ds pressLeft];
else if(testKey(chars, [settings stringForKey:PREF_KEY_UP ]))[my_ds pressUp];
else if(testKey(chars, [settings stringForKey:PREF_KEY_DOWN ]))[my_ds pressDown];
else if(testKey(chars, [settings stringForKey:PREF_KEY_R ]))[my_ds pressR];
else if(testKey(chars, [settings stringForKey:PREF_KEY_L ]))[my_ds pressL];
else if(testKey(chars, [settings stringForKey:PREF_KEY_X ]))[my_ds pressX];
else if(testKey(chars, [settings stringForKey:PREF_KEY_Y ]))[my_ds pressY];
if(testKey(chars, [settings stringForKey:PREF_KEY_A ]))[dsController pressA];
else if(testKey(chars, [settings stringForKey:PREF_KEY_B ]))[dsController pressB];
else if(testKey(chars, [settings stringForKey:PREF_KEY_SELECT]))[dsController pressSelect];
else if(testKey(chars, [settings stringForKey:PREF_KEY_START ]))[dsController pressStart];
else if(testKey(chars, [settings stringForKey:PREF_KEY_RIGHT ]))[dsController pressRight];
else if(testKey(chars, [settings stringForKey:PREF_KEY_LEFT ]))[dsController pressLeft];
else if(testKey(chars, [settings stringForKey:PREF_KEY_UP ]))[dsController pressUp];
else if(testKey(chars, [settings stringForKey:PREF_KEY_DOWN ]))[dsController pressDown];
else if(testKey(chars, [settings stringForKey:PREF_KEY_R ]))[dsController pressR];
else if(testKey(chars, [settings stringForKey:PREF_KEY_L ]))[dsController pressL];
else if(testKey(chars, [settings stringForKey:PREF_KEY_X ]))[dsController pressX];
else if(testKey(chars, [settings stringForKey:PREF_KEY_Y ]))[dsController pressY];
}
- (void)keyUp:(NSEvent*)event
@@ -201,24 +203,28 @@ inline int testKey(NSString *chars_pressed, NSString *chars_for_key)
NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
NSString *chars = [event characters];
if(testKey(chars, [settings stringForKey:PREF_KEY_A ]))[my_ds liftA];
else if(testKey(chars, [settings stringForKey:PREF_KEY_B ]))[my_ds liftB];
else if(testKey(chars, [settings stringForKey:PREF_KEY_SELECT]))[my_ds liftSelect];
else if(testKey(chars, [settings stringForKey:PREF_KEY_START ]))[my_ds liftStart];
else if(testKey(chars, [settings stringForKey:PREF_KEY_RIGHT ]))[my_ds liftRight];
else if(testKey(chars, [settings stringForKey:PREF_KEY_LEFT ]))[my_ds liftLeft];
else if(testKey(chars, [settings stringForKey:PREF_KEY_UP ]))[my_ds liftUp];
else if(testKey(chars, [settings stringForKey:PREF_KEY_DOWN ]))[my_ds liftDown];
else if(testKey(chars, [settings stringForKey:PREF_KEY_R ]))[my_ds liftR];
else if(testKey(chars, [settings stringForKey:PREF_KEY_L ]))[my_ds liftL];
else if(testKey(chars, [settings stringForKey:PREF_KEY_X ]))[my_ds liftX];
else if(testKey(chars, [settings stringForKey:PREF_KEY_Y ]))[my_ds liftY];
if(testKey(chars, [settings stringForKey:PREF_KEY_A ]))[dsController liftA];
else if(testKey(chars, [settings stringForKey:PREF_KEY_B ]))[dsController liftB];
else if(testKey(chars, [settings stringForKey:PREF_KEY_SELECT]))[dsController liftSelect];
else if(testKey(chars, [settings stringForKey:PREF_KEY_START ]))[dsController liftStart];
else if(testKey(chars, [settings stringForKey:PREF_KEY_RIGHT ]))[dsController liftRight];
else if(testKey(chars, [settings stringForKey:PREF_KEY_LEFT ]))[dsController liftLeft];
else if(testKey(chars, [settings stringForKey:PREF_KEY_UP ]))[dsController liftUp];
else if(testKey(chars, [settings stringForKey:PREF_KEY_DOWN ]))[dsController liftDown];
else if(testKey(chars, [settings stringForKey:PREF_KEY_R ]))[dsController liftR];
else if(testKey(chars, [settings stringForKey:PREF_KEY_L ]))[dsController liftL];
else if(testKey(chars, [settings stringForKey:PREF_KEY_X ]))[dsController liftX];
else if(testKey(chars, [settings stringForKey:PREF_KEY_Y ]))[dsController liftY];
}
- (void)mouseDown:(NSEvent*)event
{
NSPoint temp = [my_ds windowPointToDSCoords:[event locationInWindow]];
if(temp.x >= 0 && temp.y>=0)[my_ds touch:temp];
if(temp.x >= 0 && temp.y>=0)
{
[dsController touch:temp];
}
}
- (void)mouseDragged:(NSEvent*)event
@@ -228,7 +234,7 @@ inline int testKey(NSString *chars_pressed, NSString *chars_for_key)
- (void)mouseUp:(NSEvent*)event
{
[my_ds releaseTouch];
[dsController releaseTouch];
}
@end

View File

@@ -56,10 +56,12 @@ extern NSMenuItem *topBG0_item;
extern NSMenuItem *topBG1_item;
extern NSMenuItem *topBG2_item;
extern NSMenuItem *topBG3_item;
extern NSMenuItem *topOBJ_item;
extern NSMenuItem *subBG0_item;
extern NSMenuItem *subBG1_item;
extern NSMenuItem *subBG2_item;
extern NSMenuItem *subBG3_item;
extern NSMenuItem *subOBJ_item;
extern NSMenuItem *screenshot_to_file_item;
extern NSMenuItem *screenshot_to_window_item;
@@ -235,7 +237,8 @@ void CreateMenu(AppDelegate *delegate)
[emulation_menu addItem:[NSMenuItem separatorItem]];
//Frake skip menu
// Disabling frame skipping for now since it doesn't yield any significant speed improvements. -rogerman 03/28/2011
/*
temp = [emulation_menu addItemWithTitle:NSLocalizedString(@"Frame Skip", nil) action:nil keyEquivalent:@""];
NSMenu *frame_skip_menu = [[NSMenu alloc] initWithTitle:NSLocalizedString(@"Frame Skip", nil)];
@@ -256,7 +259,7 @@ void CreateMenu(AppDelegate *delegate)
[frame_skip_menu release];
}
*/
//Speed limit menu
temp = [emulation_menu addItemWithTitle:NSLocalizedString(@"Speed Limit", nil) action:nil keyEquivalent:@""];
@@ -366,6 +369,7 @@ void CreateMenu(AppDelegate *delegate)
topBG1_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Top BG1", nil) action:@selector(toggleTopBackground1) keyEquivalent:@""];
topBG2_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Top BG2", nil) action:@selector(toggleTopBackground2) keyEquivalent:@""];
topBG3_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Top BG3", nil) action:@selector(toggleTopBackground3) keyEquivalent:@""];
topOBJ_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Top OBJ", nil) action:@selector(toggleTopObject) keyEquivalent:@""];
[layer_menu addItem:[NSMenuItem separatorItem]];
@@ -373,6 +377,7 @@ void CreateMenu(AppDelegate *delegate)
subBG1_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Sub BG1", nil) action:@selector(toggleSubBackground1) keyEquivalent:@""];
subBG2_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Sub BG2", nil) action:@selector(toggleSubBackground2) keyEquivalent:@""];
subBG3_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Sub BG3", nil) action:@selector(toggleSubBackground3) keyEquivalent:@""];
subOBJ_item = [layer_menu addItemWithTitle:NSLocalizedString(@"Sub OBJ", nil) action:@selector(toggleSubObject) keyEquivalent:@""];
[layer_menu release];
}
@@ -496,6 +501,7 @@ int main(int argc, char *argv[])
[panel setCanChooseDirectories:NO];
[panel setCanChooseFiles:YES];
[panel setResolvesAliases:YES];
[panel setAllowsMultipleSelection:NO];
[panel setTitle:NSLocalizedString(@"Open ROM...", nil)];
@@ -545,12 +551,20 @@ int main(int argc, char *argv[])
- (void)application:(NSApplication*)sender openFiles:(NSArray*)filenames
{
//verify everything
if(sender != NSApp)goto fail;
if(!filenames)goto fail;
if([filenames count] == 0)goto fail;
if(sender != NSApp ||
filenames == nil ||
[filenames count] == 0)
{
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
return;
}
NSString *filename = [filenames lastObject];
if(!filename)goto fail;
if([filename length] == 0)goto fail;
if(!filename || [filename length] == 0)
{
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
return;
}
if([main_window loadROM:filename])
{
@@ -558,9 +572,6 @@ int main(int argc, char *argv[])
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
return;
}
fail:
[sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess];
}
- (void)applicationWillFinishLaunching:(NSNotification*)notification

View File

@@ -44,6 +44,8 @@
bool no_smaller_than_ds;
bool keep_proportions;
NSString *pathLoadedRom;
}
//initialization
@@ -102,10 +104,12 @@
- (void)toggleTopBackground1;
- (void)toggleTopBackground2;
- (void)toggleTopBackground3;
- (void)toggleTopObject;
- (void)toggleSubBackground0;
- (void)toggleSubBackground1;
- (void)toggleSubBackground2;
- (void)toggleSubBackground3;
- (void)toggleSubObject;
//screenshots
- (void)saveScreenshot;
@@ -113,4 +117,7 @@
//delegate
- (void)windowDidBecomeMain:(NSNotification*)notification;
- (BOOL)saveStateExistsInSlot:(int)slot;
- (NSString*) getSaveSlotFileName:(unsigned int)slotNumber;
@end

View File

@@ -88,10 +88,12 @@ NSMenuItem *topBG0_item = nil;
NSMenuItem *topBG1_item = nil;
NSMenuItem *topBG2_item = nil;
NSMenuItem *topBG3_item = nil;
NSMenuItem *topOBJ_item = nil;
NSMenuItem *subBG0_item = nil;
NSMenuItem *subBG1_item = nil;
NSMenuItem *subBG2_item = nil;
NSMenuItem *subBG3_item = nil;
NSMenuItem *subOBJ_item = nil;
NSMenuItem *screenshot_to_file_item = nil;
@implementation VideoOutputWindow
@@ -232,6 +234,8 @@ NSMenuItem *screenshot_to_file_item = nil;
NSResponder *temp = [window nextResponder];
[window setNextResponder:input];
[input setNextResponder:temp];
pathLoadedRom = nil;
return self;
}
@@ -244,6 +248,7 @@ NSMenuItem *screenshot_to_file_item = nil;
[status_view release];
[status_bar_text release];
[input release];
[pathLoadedRom release];
[super dealloc];
}
@@ -275,6 +280,9 @@ NSMenuItem *screenshot_to_file_item = nil;
//update the rom info window, if needed
[ROMInfo changeDS:self];
pathLoadedRom = filename;
[pathLoadedRom retain];
}
//reset menu items
@@ -283,7 +291,7 @@ NSMenuItem *screenshot_to_file_item = nil;
int i;
for(i = 0; i < MAX_SLOTS; i++)
if([saveSlot_item[i] target] == self)
if([self saveStateExists:i] == YES)
if([self saveStateExistsInSlot:i] == YES)
[saveSlot_item[i] setState:NSOnState];
else
[saveSlot_item[i] setState:NSOffState];
@@ -301,12 +309,12 @@ NSMenuItem *screenshot_to_file_item = nil;
- (void)execute
{
[super execute];
if([pause_item target] == self)
[pause_item setState:NSOffState];
if([execute_item target] == self)
[execute_item setState:NSOnState];
[self setStatusText:NSLocalizedString(@"Emulation Executing", nil)];
}
@@ -343,7 +351,7 @@ NSMenuItem *screenshot_to_file_item = nil;
- (void)setFrameSkip:(int)frameskip
{
[super setFrameSkip:frameskip];
frameskip = [super frameSkip];
frameskip = dsStateBuffer->frame_skip;
if([frame_skip_auto_item target] == self)
if(frameskip < 0)
@@ -385,7 +393,8 @@ NSMenuItem *screenshot_to_file_item = nil;
[super setSpeedLimit:speedLimit];
//Set the correct menu states
speedLimit = [super speedLimit];
speedLimit = dsStateBuffer->speed_limit;
int standard_size = 0;
if([speed_limit_25_item target] == self)
@@ -511,23 +520,65 @@ NSMenuItem *screenshot_to_file_item = nil;
- (BOOL)saveStateToSlot:(int)slot
{
if([super saveStateToSlot:slot] == YES)
BOOL result = NO;
int i = slot;
NSString *savePath = GetPathUserAppSupport(@"States");
if (savePath == nil)
{
if([saveSlot_item[slot] target] == self);
[saveSlot_item[slot] setState:NSOnState];
// Throw an error message here...
return result;
}
result = CreateAppDirectory(@"States");
if (result == NO)
{
// Should throw an error message here...
return result;
}
NSString *fileName = [self getSaveSlotFileName:slot];
if (fileName == nil)
{
return result;
}
NSString *fullFilePath = [[savePath stringByAppendingString:@"/"] stringByAppendingString:fileName];
result = [self saveState:fullFilePath];
if(result)
{
if([saveSlot_item[i] target] == self);
{
[saveSlot_item[i] setState:NSOnState];
}
//if([clear_all_saves_item target] == self);
//[clear_all_saves_item setEnabled:YES];
return YES;
result = YES;
}
return NO;
return result;
}
- (BOOL)loadStateFromSlot:(int)slot
{
return [super loadStateFromSlot:slot];
BOOL result = NO;
NSString *savePath = GetPathUserAppSupport(@"States");
if (savePath == nil)
{
// Should throw an error message here...
return result;
}
NSString *fileName = [self getSaveSlotFileName:slot];
if (fileName == nil)
{
return result;
}
NSString *fullFilePath = [[savePath stringByAppendingString:@"/"] stringByAppendingString:fileName];
result = [self loadState:fullFilePath];
return result;
}
- (BOOL)saveStateAs
@@ -666,60 +717,103 @@ NSMenuItem *screenshot_to_file_item = nil;
- (NSPoint)windowPointToDSCoords:(NSPoint)location
{
if(video_output_view == nil)return NSMakePoint(-1, -1);
NSSize temp = [[window contentView] frame].size;
CGFloat rotation;
NSSize temp;
float statusBarHeight;
if(video_output_view == nil)
{
return NSMakePoint(-1, -1);
}
rotation = [video_output_view boundsRotation];
statusBarHeight = [self statusBarHeight];
temp = [[window contentView] frame].size;
CGFloat x_size = temp.width - WINDOW_BORDER_PADDING*2;
CGFloat y_size = temp.height - [self statusBarHeight];
CGFloat y_size = temp.height - statusBarHeight;
//If the click was to the left or under the opengl view, exit
if((location.x < WINDOW_BORDER_PADDING) || (location.y < [self statusBarHeight]))
if((location.x < WINDOW_BORDER_PADDING) || (location.y < statusBarHeight))
{
return NSMakePoint(-1, -1);
}
location.x -= WINDOW_BORDER_PADDING;
location.y -= [self statusBarHeight];
location.y -= statusBarHeight;
//If the click was top or right of the view...
if(location.x >= x_size)return NSMakePoint(-1, -1);
if(location.y >= y_size)return NSMakePoint(-1, -1);
if([video_output_view boundsRotation] == 0 || [video_output_view boundsRotation] == -180)
if(location.x >= x_size)
{
if([video_output_view boundsRotation] == -180)
return NSMakePoint(-1, -1);
}
if(location.y >= y_size)
{
return NSMakePoint(-1, -1);
}
if(rotation == 0)
{
if(location.y >= y_size / 2)
{
if(location.y < y_size / 2)return NSMakePoint(-1, -1);
location.x = x_size - location.x;
location.y = y_size - location.y;
} else
if(location.y >= y_size / 2)return NSMakePoint(-1, -1);
return NSMakePoint(-1, -1);
}
//scale the coordinates
location.x *= ((float)DS_SCREEN_WIDTH) / ((float)x_size);
location.y *= ((float)DS_SCREEN_HEIGHT_COMBINED) / ((float)y_size);
//invert the y
location.y = DS_SCREEN_HEIGHT - location.y - 1;
} else
}
else if(rotation = -90)
{
if([video_output_view boundsRotation] == -270)
if(location.x >= x_size / 2)
{
if(location.x < x_size / 2)return NSMakePoint(-1, -1);
location.x = x_size - location.x;
} else
{
if(location.x >= x_size / 2)return NSMakePoint(-1, -1);
location.y = y_size - location.y;
return NSMakePoint(-1, -1);
}
location.y = y_size - location.y;
location.x *= ((float)DS_SCREEN_HEIGHT_COMBINED) / ((float)x_size);
location.y *= ((float)DS_SCREEN_WIDTH) / ((float)y_size);
//invert the y
location.x = DS_SCREEN_HEIGHT - location.x - 1;
float temp = location.x;
location.x = location.y;
location.y = temp;
}
else if(rotation = -180)
{
if(location.y < y_size / 2)
{
return NSMakePoint(-1, -1);
}
location.x = x_size - location.x;
location.y = y_size - location.y;
//scale the coordinates
location.x *= ((float)DS_SCREEN_WIDTH) / ((float)x_size);
location.y *= ((float)DS_SCREEN_HEIGHT_COMBINED) / ((float)y_size);
//invert the y
location.y = DS_SCREEN_HEIGHT - location.y - 1;
}
else if(rotation = -270)
{
if(location.x < x_size / 2)
{
return NSMakePoint(-1, -1);
}
location.x = x_size - location.x;
location.x *= ((float)DS_SCREEN_HEIGHT_COMBINED) / ((float)x_size);
location.y *= ((float)DS_SCREEN_WIDTH) / ((float)y_size);
//invert the y
location.x = DS_SCREEN_HEIGHT - location.x - 1;
float temp = location.x;
location.x = location.y;
location.y = temp;
@@ -874,10 +968,10 @@ NSMenuItem *screenshot_to_file_item = nil;
- (void)toggleTopBackground0
{
[super toggleTopBackground0];
[self toggleSubScreenLayer:0];
if([topBG0_item target] == self)
if([super showingTopBackground0] == NO)
if([self isSubScreenLayerDisplayed:0] == NO)
[topBG0_item setState:NSOffState];
else
[topBG0_item setState:NSOnState];
@@ -885,10 +979,10 @@ NSMenuItem *screenshot_to_file_item = nil;
- (void)toggleTopBackground1
{
[super toggleTopBackground1];
[self toggleSubScreenLayer:1];
if([topBG1_item target] == self)
if([super showingTopBackground1] == NO)
if([self isSubScreenLayerDisplayed:1] == NO)
[topBG1_item setState:NSOffState];
else
[topBG1_item setState:NSOnState];
@@ -896,10 +990,10 @@ NSMenuItem *screenshot_to_file_item = nil;
- (void)toggleTopBackground2
{
[super toggleTopBackground2];
[self toggleSubScreenLayer:2];
if([topBG2_item target] == self)
if([super showingTopBackground2] == NO)
if([self isSubScreenLayerDisplayed:2] == NO)
[topBG2_item setState:NSOffState];
else
[topBG2_item setState:NSOnState];
@@ -907,21 +1001,32 @@ NSMenuItem *screenshot_to_file_item = nil;
- (void)toggleTopBackground3
{
[super toggleTopBackground3];
[self toggleSubScreenLayer:3];
if([topBG3_item target] == self)
if([super showingTopBackground3] == NO)
if([self isSubScreenLayerDisplayed:3] == NO)
[topBG3_item setState:NSOffState];
else
[topBG3_item setState:NSOnState];
}
- (void)toggleTopObject
{
[self toggleSubScreenLayer:4];
if([topOBJ_item target] == self)
if([self isSubScreenLayerDisplayed:4] == NO)
[topOBJ_item setState:NSOffState];
else
[topOBJ_item setState:NSOnState];
}
- (void)toggleSubBackground0
{
[super toggleSubBackground0];
[self toggleMainScreenLayer:0];
if([subBG0_item target] == self)
if([super showingSubBackground0] == NO)
if([self isMainScreenLayerDisplayed:0] == NO)
[subBG0_item setState:NSOffState];
else
[subBG0_item setState:NSOnState];
@@ -929,10 +1034,10 @@ NSMenuItem *screenshot_to_file_item = nil;
- (void)toggleSubBackground1
{
[super toggleSubBackground1];
[self toggleMainScreenLayer:1];
if([subBG1_item target] == self)
if([super showingSubBackground1] == NO)
if([self isMainScreenLayerDisplayed:1] == NO)
[subBG1_item setState:NSOffState];
else
[subBG1_item setState:NSOnState];
@@ -940,10 +1045,10 @@ NSMenuItem *screenshot_to_file_item = nil;
- (void)toggleSubBackground2
{
[super toggleSubBackground2];
[self toggleMainScreenLayer:2];
if([subBG2_item target] == self)
if([super showingSubBackground2] == NO)
if([self isMainScreenLayerDisplayed:2] == NO)
[subBG2_item setState:NSOffState];
else
[subBG2_item setState:NSOnState];
@@ -951,15 +1056,26 @@ NSMenuItem *screenshot_to_file_item = nil;
- (void)toggleSubBackground3
{
[super toggleSubBackground3];
[self toggleMainScreenLayer:3];
if([subBG3_item target] == self)
if([super showingSubBackground3] == NO)
if([self isMainScreenLayerDisplayed:3] == NO)
[subBG3_item setState:NSOffState];
else
[subBG3_item setState:NSOnState];
}
- (void)toggleSubObject
{
[self toggleMainScreenLayer:4];
if([subOBJ_item target] == self)
if([self isMainScreenLayerDisplayed:4] == NO)
[subOBJ_item setState:NSOffState];
else
[subOBJ_item setState:NSOnState];
}
- (void)saveScreenshot
{//todo: this should work even if video_output_view doesn't exist
BOOL executing = [self executing];
@@ -1145,7 +1261,7 @@ NSMenuItem *screenshot_to_file_item = nil;
[saveSlot_item[i] setTarget:self];
[loadSlot_item[i] setTarget:self];
if([self saveStateExists:i] == YES)
if([self saveStateExistsInSlot:i] == YES)
{
[saveSlot_item[i] setState:NSOnState];
} else
@@ -1211,10 +1327,12 @@ NSMenuItem *screenshot_to_file_item = nil;
[topBG1_item setTarget:self];
[topBG2_item setTarget:self];
[topBG3_item setTarget:self];
[topOBJ_item setTarget:self];
[subBG0_item setTarget:self];
[subBG1_item setTarget:self];
[subBG2_item setTarget:self];
[subBG3_item setTarget:self];
[subOBJ_item setTarget:self];
[screenshot_to_file_item setTarget:self];
//set checks for view window based on the options of this window
@@ -1222,38 +1340,56 @@ NSMenuItem *screenshot_to_file_item = nil;
[constrain_item setState:keep_proportions?NSOnState:NSOffState];
[min_size_item setState:no_smaller_than_ds?NSOnState:NSOffState];
[toggle_status_bar_item setState:(status_view!=nil)?NSOnState:NSOffState];
if([self showingTopBackground0])
if([self isSubScreenLayerDisplayed:0] == YES)
[topBG0_item setState:NSOnState];
else
[topBG0_item setState:NSOffState];
if([self showingTopBackground1])
if([self isSubScreenLayerDisplayed:1] == YES)
[topBG1_item setState:NSOnState];
else
[topBG1_item setState:NSOffState];
if([self showingTopBackground2])
if([self isSubScreenLayerDisplayed:2] == YES)
[topBG2_item setState:NSOnState];
else
[topBG2_item setState:NSOffState];
if([self showingTopBackground3])
if([self isSubScreenLayerDisplayed:3] == YES)
[topBG3_item setState:NSOnState];
else
[topBG3_item setState:NSOffState];
if([self showingSubBackground0])
if([self isSubScreenLayerDisplayed:4] == YES)
[topOBJ_item setState:NSOnState];
else
[topOBJ_item setState:NSOffState];
if([self isMainScreenLayerDisplayed:0] == YES)
[subBG0_item setState:NSOnState];
else
[subBG0_item setState:NSOffState];
if([self showingSubBackground1])
if([self isMainScreenLayerDisplayed:1] == YES)
[subBG1_item setState:NSOnState];
else
[subBG1_item setState:NSOffState];
if([self showingSubBackground2])
if([self isMainScreenLayerDisplayed:2] == YES)
[subBG2_item setState:NSOnState];
else
[subBG2_item setState:NSOffState];
if([self showingSubBackground3])
if([self isMainScreenLayerDisplayed:3] == YES)
[subBG3_item setState:NSOnState];
else
[subBG3_item setState:NSOffState];
if([self isMainScreenLayerDisplayed:4] == YES)
[subOBJ_item setState:NSOnState];
else
[subOBJ_item setState:NSOffState];
[self setRotation:[self rotation]];
@@ -1315,7 +1451,7 @@ NSMenuItem *screenshot_to_file_item = nil;
else
for(i = 0; i < MAX_SLOTS; i++)
if(item == loadSlot_item[i])
if([self saveStateExists:i]==NO)return NO;
if([self saveStateExistsInSlot:i] == NO)return NO;
if(video_output_view == nil)
{
@@ -1340,4 +1476,33 @@ NSMenuItem *screenshot_to_file_item = nil;
return YES;
}
- (BOOL)saveStateExistsInSlot:(int)slot
{
BOOL exists = false;
NSString *searchPath = GetPathUserAppSupport(@"States");
NSString *searchFileName = [self getSaveSlotFileName:slot];
if (searchPath == nil || searchFileName == nil)
{
return exists;
}
NSFileManager *fileManager = [[NSFileManager alloc] init];
NSString *searchFullPath = [[searchPath stringByAppendingString:@"/"] stringByAppendingString:searchFileName];
exists = [fileManager isReadableFileAtPath:searchFullPath];
[fileManager release];
return exists;
}
- (NSString*) getSaveSlotFileName:(unsigned int)slotNumber
{
NSString *fileExtension = [NSString stringWithFormat:@".ds%d", slotNumber];
return [[[pathLoadedRom lastPathComponent] stringByDeletingPathExtension] stringByAppendingString:fileExtension];
}
@end

View File

@@ -18,6 +18,7 @@
*/
#import "globals.h"
#import "cocoa_input.h"
@class ScreenState;
@@ -29,6 +30,17 @@
#define MAX_SLOTS 10
#define MAX_FRAME_SKIP 10
@interface CocoaDSStateBuffer : NSObject
{
@public
int frame_skip;
int speed_limit;
}
- (id) init;
@end
//This class is a compelte objective-c wrapper for
//the core emulation features, other objective-c code inherit
//upon or instanciate this to add interfaces for these features
@@ -65,6 +77,11 @@
NSString *current_file;
NSString *flash_file;
bool doesConfigNeedUpdate;
NSTimeInterval calcTimeBudget;
CocoaDSController *dsController;
#ifdef GDB_STUB
NSInteger arm9_gdb_port;
@@ -74,6 +91,9 @@
#endif
unsigned char gpu_buff[256 * 256 * 5]; //this is where the 3D rendering of the NDS is stored
@public
CocoaDSStateBuffer *dsStateBuffer;
}
//Instanciating, setup, and deconstruction
@@ -82,6 +102,9 @@
- (void)setErrorCallback:(SEL)callback withObject:(id)object;
- (void)dealloc;
// Data accessors
- (CocoaDSController*) getDSController;
//Firmware control
- (void)setPlayerName:(NSString*)player_name;
@@ -116,73 +139,19 @@
- (int)speedLimit;
- (void)setSaveType:(int)savetype; // see save_types in src/mmu.h
- (int)saveType; // default is 0, which is autodetect
//touch screen
- (void)touch:(NSPoint)point;
- (void)releaseTouch;
//button input
- (void)pressStart;
- (void)liftStart;
- (BOOL)start;
- (void)pressSelect;
- (void)liftSelect;
- (BOOL)select;
- (void)pressLeft;
- (void)liftLeft;
- (BOOL)left;
- (void)pressRight;
- (void)liftRight;
- (BOOL)right;
- (void)pressUp;
- (void)liftUp;
- (BOOL)up;
- (void)pressDown;
- (void)liftDown;
- (BOOL)down;
- (void)pressA;
- (void)liftA;
- (BOOL)A;
- (void)pressB;
- (void)liftB;
- (BOOL)B;
- (void)pressX;
- (void)liftX;
- (BOOL)X;
- (void)pressY;
- (void)liftY;
- (BOOL)Y;
- (void)pressL;
- (void)liftL;
- (BOOL)L;
- (void)pressR;
- (void)liftR;
- (BOOL)R;
- (void) updateConfig;
- (void) emulateDS;
- (void) drawFrame;
- (void) padTime:(NSTimeInterval)timePad;
//save states
- (BOOL)saveState:(NSString*)file;
- (BOOL)loadState:(NSString*)file;
- (BOOL)saveStateToSlot:(int)slot; //0 to MAX_SLOTS-1, anything else is ignored
- (BOOL)loadStateFromSlot:(int)slot;
- (BOOL)saveStateExists:(int)slot;
//layers
- (void)toggleTopBackground0;
- (BOOL)showingTopBackground0;
- (void)toggleTopBackground1;
- (BOOL)showingTopBackground1;
- (void)toggleTopBackground2;
- (BOOL)showingTopBackground2;
- (void)toggleTopBackground3;
- (BOOL)showingTopBackground3;
- (void)toggleSubBackground0;
- (BOOL)showingSubBackground0;
- (void)toggleSubBackground1;
- (BOOL)showingSubBackground1;
- (void)toggleSubBackground2;
- (BOOL)showingSubBackground2;
- (void)toggleSubBackground3;
- (BOOL)showingSubBackground3;
- (BOOL) isSubScreenLayerDisplayed:(int)i;
- (BOOL) isMainScreenLayerDisplayed:(int)i;
- (void) toggleMainScreenLayer:(int)i;
- (void) toggleSubScreenLayer:(int)i;
//Sound
- (BOOL)hasSound;

File diff suppressed because it is too large Load Diff

View File

@@ -17,9 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define OBJ_C
#include "../SPU.h"
#undef OBJ_C
#ifdef __cplusplus
extern "C"

View File

@@ -29,9 +29,7 @@
#include <AudioToolbox/AudioToolbox.h>
//desmume includes
#define OBJ_C
#include "sndOSX.h"
#undef BOOL
//globals
AudioUnit output_unit = NULL; //pointer to our audio device

View File

@@ -2801,3 +2801,62 @@ void GFX3D_Clipper::clipPoly(POLY* poly, VERT** verts)
}
#endif
// "Workaround" for line poly
bool gfx3d_IsLinePoly(POLY *poly)
{
int type = poly->type;
VERT *vert1, *vert2;
if (type <= 2)
return true;
else if (type > 10)
return false;
// Method 1:
// Castlevania Portrait of Ruin - trajectory of ricochet
bool duplicatedVert[10];
for(int i = 0; i < type; i++)
duplicatedVert[i] = false;
for(int i = 0; i < type - 1; i++)
{
vert1 = &gfx3d.vertlist->list[poly->vertIndexes[i]];
for(int j = i + 1; j < type; j++)
{
vert2 = &gfx3d.vertlist->list[poly->vertIndexes[j]];
if (vert1->x == vert2->x && vert1->y == vert2->y)
{
duplicatedVert[j] = true;
}
}
}
int vertCount = type;
for(int i = 0; i < type; i++)
{
if (duplicatedVert[i])
vertCount--;
}
if (vertCount <= 2)
return true;
// Method 2:
// Castlevania Portrait of Ruin - warp stone
bool horizontalLine = true;
bool verticalLine = true;
vert1 = &gfx3d.vertlist->list[poly->vertIndexes[0]];
for(int i = 1; i < type && (horizontalLine || verticalLine); i++)
{
vert2 = &gfx3d.vertlist->list[poly->vertIndexes[i]];
if (vert1->coord[0] != vert2->coord[0])
{
verticalLine = false;
}
if (vert1->coord[1] != vert2->coord[1])
{
horizontalLine = false;
}
}
if (horizontalLine || verticalLine)
return true;
return false;
}

View File

@@ -450,4 +450,6 @@ bool gfx3d_loadstate(EMUFILE* is, int size);
void gfx3d_ClearStack();
bool gfx3d_IsLinePoly(POLY *poly);
#endif //_GFX3D_H_

View File

@@ -27,6 +27,9 @@
#include "main.h"
#include "desmume.h"
#undef GPOINTER_TO_INT
#define GPOINTER_TO_INT(p) ((gint) (glong) (p))
enum {
COLUMN_ENABLED,
COLUMN_SIZE,

View File

@@ -66,6 +66,12 @@
#include "DeSmuME.xpm"
#undef GPOINTER_TO_INT
#define GPOINTER_TO_INT(p) ((gint) (glong) (p))
#undef GPOINTER_TO_UINT
#define GPOINTER_TO_UINT(p) ((guint) (glong) (p))
#define EMULOOP_PRIO (G_PRIORITY_HIGH_IDLE + 20)
#if GTK_CHECK_VERSION(2,10,0)
@@ -1223,6 +1229,8 @@ static gboolean ExposeDrawingArea (GtkWidget *widget, GdkEventExpose *event, gpo
gdk_cairo_set_source_pixbuf(cr, drawPixbuf, primaryOffsetX, primaryOffsetY);
}
g_object_unref(drawPixbuf);
cairo_paint(cr);
cairo_destroy(cr);

View File

@@ -25,6 +25,9 @@
#include "../MMU.h"
#undef GPOINTER_TO_INT
#define GPOINTER_TO_INT(p) ((gint) (glong) (p))
#define SHORTNAME "ioregs"
#define TOOL_NAME "IO regs view"

View File

@@ -13,9 +13,10 @@
#include "saves.h"
#include "emufile.h"
#if defined(WIN32) && !defined(WXPORT)
#include <windows.h>
#include "main.h"
#include "windows.h"
#include "video.h"
#include "resource.h"
#endif
#ifdef WIN32
#include <direct.h>
@@ -60,6 +61,27 @@ struct LuaGUIData
int xMin, yMin, xMax, yMax;
};
struct LuaSubMenuData
{
PlatformMenu menu;
PlatformMenu subMenu;
PlatformMenuItem menuItem;
LuaSubMenuData(PlatformMenu _menu, PlatformMenu _subMenu, PlatformMenuItem _menuItem)
{
menu = _menu;
subMenu = _subMenu;
menuItem = _menuItem;
}
};
struct LuaMenuData
{
std::vector<LuaSubMenuData> subMenuData;
std::map<PlatformMenuItem, PlatformMenu> menuItemMap;
};
static const char* menuCallbackIDString = "menuhandlers";
struct LuaContextInfo {
lua_State* L; // the Lua state
bool started; // script has been started and hasn't yet been terminated, although it may not be currently running
@@ -88,6 +110,7 @@ struct LuaContextInfo {
LuaSaveData newDefaultData; // data about the default state of persisted global variables, which we save on script exit so we can detect when the default value has changed to make it easier to reset persisted variables
unsigned int numMemHooks; // number of registered memory functions (1 per hooked byte)
LuaGUIData guiData;
LuaMenuData menuData;
// callbacks into the lua window... these don't need to exist per context the way I'm using them, but whatever
void(*print)(int uid, const char* str);
void(*onstart)(int uid);
@@ -143,6 +166,7 @@ static const char* luaCallIDStrings [] =
"CALL_BEFORESAVE",
"CALL_AFTERLOAD",
"CALL_ONSTART",
"CALL_ONINITMENU",
"CALL_HOTKEY_1",
"CALL_HOTKEY_2",
@@ -1731,7 +1755,7 @@ DEFINE_LUA_FUNCTION(memory_readword, "address")
int address = luaL_checkinteger(L,1);
unsigned short value = (unsigned short)(_MMU_read16<ARMCPU_ARM9>(address) & 0xFFFF);
lua_settop(L,0);
lua_pushinteger(L, value);
lua_pushnumber(L, value); // can't use pushinteger in this case (out of range)
return 1;
}
DEFINE_LUA_FUNCTION(memory_readwordsigned, "address")
@@ -1747,7 +1771,7 @@ DEFINE_LUA_FUNCTION(memory_readdword, "address")
int address = luaL_checkinteger(L,1);
unsigned long value = (unsigned long)(_MMU_read32<ARMCPU_ARM9>(address));
lua_settop(L,0);
lua_pushinteger(L, value);
lua_pushnumber(L, value); // can't use pushinteger in this case (out of range)
return 1;
}
DEFINE_LUA_FUNCTION(memory_readdwordsigned, "address")
@@ -3211,7 +3235,7 @@ DEFINE_LUA_FUNCTION(gui_gdscreenshot, "[whichScreen='both']")
{
for(int x = curGuiData.xMin; x < curGuiData.xMax; x++)
{
*ptr++ = 255 - Src[4*x+3];
*ptr++ = 0 /* (255 - Src[4*x+3]) / 2 */; // alpha (0-127, 0=opaque, 127=transparent)
*ptr++ = Src[4*x+2];
*ptr++ = Src[4*x+1];
*ptr++ = Src[4*x+0];
@@ -3406,6 +3430,332 @@ DEFINE_LUA_FUNCTION(emu_reset, "")
return 0;
}
static bool IsLuaMenuItem(PlatformMenuItem menuItem)
{
#if defined(WIN32) && !defined(WXPORT)
return (menuItem >= IDC_LUAMENU_RESERVE_START && menuItem <= IDC_LUAMENU_RESERVE_END);
#else
return false;
#endif
}
static bool SearchFreeMenuItem(PlatformMenu menu, PlatformMenuItem& menuItem)
{
#if defined(WIN32) && !defined(WXPORT)
for (UINT menuItemId = IDC_LUAMENU_RESERVE_START; menuItemId <= IDC_LUAMENU_RESERVE_END; menuItemId++)
{
MENUITEMINFO mii;
ZeroMemory(&mii, sizeof(MENUITEMINFO));
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_ID;
if (!GetMenuItemInfo(menu, menuItemId, FALSE, &mii) &&
GetLastError() == ERROR_MENU_ITEM_NOT_FOUND)
{
menuItem = menuItemId;
return true;
}
}
return false;
#else
return false;
#endif
}
static PlatformMenu AddSubMenu(PlatformMenu topMenu, PlatformMenu menu, const char* menuName)
{
#if defined(WIN32) && !defined(WXPORT)
LuaContextInfo& info = GetCurrentInfo();
MENUITEMINFO mii;
// search existing submenu
for (int index = 0; index < GetMenuItemCount(menu); index++)
{
ZeroMemory(&mii, sizeof(MENUITEMINFO));
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_ID | MIIM_SUBMENU | MIIM_STRING;
const UINT bufferSize = 128;
TCHAR menuItemText[bufferSize];
mii.dwTypeData = menuItemText;
mii.cch = bufferSize;
GetMenuItemInfo(menu, index, TRUE, &mii);
// if exists, return it
if (mii.hSubMenu != NULL && lstrcmp(menuName, mii.dwTypeData) == 0)
{
if (IsLuaMenuItem(mii.wID))
{
info.menuData.subMenuData.push_back(LuaSubMenuData(menu, mii.hSubMenu, mii.wID));
}
return mii.hSubMenu;
}
}
// add new submenu
UINT subMenuId;
if (!SearchFreeMenuItem(topMenu, subMenuId))
{
return NULL;
}
ZeroMemory(&mii, sizeof(MENUITEMINFO));
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_SUBMENU;
mii.fType = MFT_STRING;
mii.fState = MFS_ENABLED;
mii.wID = subMenuId;
mii.hSubMenu = CreatePopupMenu();
mii.dwTypeData = (char*) menuName;
if (!InsertMenuItem(menu, (UINT)-1, TRUE, &mii))
{
if (mii.hSubMenu != NULL)
{
DestroyMenu(mii.hSubMenu);
}
return NULL;
}
info.menuData.subMenuData.push_back(LuaSubMenuData(menu, mii.hSubMenu, subMenuId));
return mii.hSubMenu;
#else
return 0;
#endif
}
bool AddMenuEntries(PlatformMenu topMenu, PlatformMenu menu)
{
#if defined(WIN32) && !defined(WXPORT)
LuaContextInfo& info = GetCurrentInfo();
lua_State* L = info.L;
luaL_checktype(L, -1, LUA_TTABLE);
luaL_checkstack(L, 6, "");
// for index = 1, #menuEntries
unsigned int count = lua_objlen(L, -1);
for (unsigned int index = 1; index <= count; index++)
{
// switch(type(menuEntries[index]))
lua_rawgeti(L, -1, index);
if (lua_isnil(L, -1))
{
UINT menuItem;
if (!SearchFreeMenuItem(topMenu, menuItem))
{
luaL_error(L, "too many menu items");
return false;
}
MENUITEMINFO mii;
ZeroMemory(&mii, sizeof(MENUITEMINFO));
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_ID | MIIM_FTYPE;
mii.wID = menuItem;
mii.fType = MFT_SEPARATOR;
if (!InsertMenuItem(menu, menuItem, FALSE, &mii))
{
luaL_error(L, "menu item addition failed");
return false;
}
info.menuData.menuItemMap.insert(map<PlatformMenuItem, PlatformMenu>::value_type(menuItem, menu));
lua_pop(L, 1);
}
else if (lua_istable(L, -1))
{
lua_rawgeti(L, -1, 1);
const char* menuName = luaL_checkstring(L, -1);
lua_insert(L, -2);
lua_rawgeti(L, -1, 2);
if (lua_isfunction(L, -1))
{
UINT menuItem;
if (!SearchFreeMenuItem(topMenu, menuItem))
{
luaL_error(L, "too many menu items");
return false;
}
MENUITEMINFO mii;
ZeroMemory(&mii, sizeof(MENUITEMINFO));
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_ID | MIIM_STRING;
mii.wID = menuItem;
mii.dwTypeData = (char*) menuName;
if (!InsertMenuItem(menu, menuItem, FALSE, &mii))
{
luaL_error(L, "menu item addition failed");
return false;
}
info.menuData.menuItemMap.insert(map<PlatformMenuItem, PlatformMenu>::value_type(menuItem, menu));
lua_getfield(L, LUA_REGISTRYINDEX, menuCallbackIDString);
lua_insert(L, -2);
lua_rawseti(L, -2, menuItem);
lua_pop(L, 3);
}
else if (lua_istable(L, -1))
{
HMENU subMenu = AddSubMenu(topMenu, menu, menuName);
if (subMenu == NULL)
{
luaL_error(L, "menu item addition failed");
return false;
}
if (!AddMenuEntries(topMenu, subMenu))
{
return false;
}
lua_pop(L, 3);
}
else
{
luaL_typerror(L, -1, "function or table");
return false;
}
}
else
{
luaL_typerror(L, -1, "nil or table");
return false;
}
}
return true;
#else
return false;
#endif
}
DEFINE_LUA_FUNCTION(emu_addmenu, "menuName, menuEntries")
{
#if defined(WIN32) && !defined(WXPORT)
int nargs = lua_gettop(L);
if (nargs > 1 && !lua_isnil(L, 1))
{
const char* menuName = luaL_checkstring(L, 1);
luaL_checktype(L, 2, LUA_TTABLE);
lua_settop(L, 2); // drop redundant args
HMENU menu = mainMenu;
HMENU subMenu = AddSubMenu(menu, menu, menuName);
if (subMenu != NULL)
{
AddMenuEntries(menu, subMenu);
DrawMenuBar(MainWindow->getHWnd());
}
else
{
luaL_error(L, "menu item addition failed");
}
}
else
{
//HMENU menu = NULL; // TODO: set popup (right-click) menu
//int index = (nargs > 1) ? 2 : 1;
//luaL_checktype(L, index, LUA_TTABLE);
//lua_settop(L, index); // drop redundant args
//AddMenuEntries(menu, menu);
}
#endif
return 0;
}
DEFINE_LUA_FUNCTION(emu_setmenuiteminfo, "menuItem, infoTable")
{
luaL_checktype(L, 1, LUA_TFUNCTION);
luaL_checktype(L, 2, LUA_TTABLE);
#if defined(WIN32) && !defined(WXPORT)
LuaContextInfo& info = GetCurrentInfo();
map<PlatformMenuItem, PlatformMenu>::iterator it = info.menuData.menuItemMap.begin();
while(it != info.menuData.menuItemMap.end())
{
HMENU menu = (*it).second;
UINT menuItem = (*it).first;
lua_getfield(L, LUA_REGISTRYINDEX, menuCallbackIDString);
lua_rawgeti(L, -1, menuItem);
if (lua_rawequal(L, 1, -1) != 0)
{
MENUITEMINFO mii;
ZeroMemory(&mii, sizeof(MENUITEMINFO));
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_STATE | MIIM_STRING;
GetMenuItemInfo(menu, menuItem, FALSE, &mii);
mii.fMask = 0;
lua_getfield(L, 2, "enabled");
if (lua_isboolean(L, -1))
{
mii.fMask |= MIIM_STATE;
if (lua_toboolean(L, -1) != 0)
{
mii.fState &= ~MFS_DISABLED;
}
else
{
mii.fState |= MFS_DISABLED;
}
}
else if (!lua_isnil(L, -1))
{
luaL_where(L, 0);
luaL_error(L, "%s bad argument \"enabled\" (boolean expected, got %s)",
luaL_optstring(L, -1, ""), luaL_typename(L, -2));
}
lua_pop(L, 1);
lua_getfield(L, 2, "checked");
if (lua_isboolean(L, -1))
{
mii.fMask |= MIIM_STATE;
if (lua_toboolean(L, -1) != 0)
{
mii.fState |= MFS_CHECKED;
}
else
{
mii.fState &= ~MFS_CHECKED;
}
}
else if (!lua_isnil(L, -1))
{
luaL_where(L, 0);
luaL_error(L, "%s bad argument \"checked\" (boolean expected, got %s)",
luaL_optstring(L, -1, ""), luaL_typename(L, -2));
}
lua_pop(L, 1);
lua_getfield(L, 2, "name");
if (lua_isstring(L, -1))
{
mii.fMask |= MIIM_STRING;
mii.dwTypeData = (LPSTR) lua_tostring(L, -1);
}
else if (!lua_isnil(L, -1))
{
luaL_where(L, 0);
luaL_error(L, "%s bad argument \"name\" (string expected, got %s)",
luaL_optstring(L, -1, ""), luaL_typename(L, -2));
}
SetMenuItemInfo(menu, menuItem, FALSE, &mii);
lua_pop(L, 1);
}
lua_pop(L, 1);
it++;
}
#endif
return 0;
}
DEFINE_LUA_FUNCTION(emu_registermenustart, "func")
{
if (!lua_isnil(L,1))
luaL_checktype(L, 1, LUA_TFUNCTION);
lua_settop(L,1);
lua_getfield(L, LUA_REGISTRYINDEX, luaCallIDStrings[LUACALL_ONINITMENU]);
lua_insert(L,1);
lua_setfield(L, LUA_REGISTRYINDEX, luaCallIDStrings[LUACALL_ONINITMENU]);
StopScriptIfFinished(luaStateToUIDMap[L->l_G->mainthread]);
return 1;
}
// TODO
/*
DEFINE_LUA_FUNCTION(emu_loadrom, "filename")
@@ -4152,6 +4502,9 @@ static const struct luaL_reg emulib [] =
{"openscript", emu_openscript},
// {"loadrom", emu_loadrom},
{"reset", emu_reset},
{"addmenu", emu_addmenu},
{"setmenuiteminfo", emu_setmenuiteminfo},
{"registermenustart", emu_registermenustart},
// alternative names
// {"openrom", emu_loadrom},
{NULL, NULL}
@@ -4539,6 +4892,10 @@ void registerLibs(lua_State* L)
lua_setfield(L, LUA_REGISTRYINDEX, luaMemHookTypeStrings[i]);
}
// push an array for menu handlers
lua_newtable(L);
lua_setfield(L, LUA_REGISTRYINDEX, menuCallbackIDString);
// register type
luaL_newmetatable(L, "EMUFILE_MEMORY*");
lua_pushcfunction(L, gcEMUFILE_MEMORY);
@@ -4699,7 +5056,7 @@ void StopScriptIfFinished(int uid, bool justReturned)
// because it may have registered a function that it expects to keep getting called
// so check if it has any registered functions and stop the script only if it doesn't
bool keepAlive = (info.numMemHooks != 0);
bool keepAlive = (info.numMemHooks != 0 || !info.menuData.menuItemMap.empty());
for(int calltype = 0; calltype < LUACALL_COUNT && !keepAlive; calltype++)
{
lua_State* L = info.L;
@@ -4943,6 +5300,43 @@ void StopLuaScript(int uid)
info.numMemHooks = 0;
for(int i = 0; i < LUAMEMHOOK_COUNT; i++)
CalculateMemHookRegions((LuaMemHookType)i);
#if defined(WIN32) && !defined(WXPORT)
// remove items
map<PlatformMenuItem, PlatformMenu>::iterator it = info.menuData.menuItemMap.begin();
while(it != info.menuData.menuItemMap.end())
{
HMENU menu = (*it).second;
UINT menuItem = (*it).first;
DeleteMenu(menu, menuItem, MF_BYCOMMAND);
it++;
}
info.menuData.menuItemMap.clear();
// remove submenus
vector<LuaSubMenuData>::reverse_iterator rit = info.menuData.subMenuData.rbegin();
while(rit != info.menuData.subMenuData.rend())
{
HMENU menu = (*rit).menu;
UINT menuItem = (*rit).menuItem;
MENUITEMINFO mii;
ZeroMemory(&mii, sizeof(MENUITEMINFO));
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_SUBMENU;
GetMenuItemInfo(menu, menuItem, FALSE, &mii);
HMENU subMenu = mii.hSubMenu;
// delete if it's empty
if (GetMenuItemCount(subMenu) == 0)
{
DeleteMenu(menu, menuItem, MF_BYCOMMAND);
}
rit++;
}
info.menuData.subMenuData.clear();
DrawMenuBar(MainWindow->getHWnd());
#endif
}
RefreshScriptStartedStatus();
}
@@ -5053,6 +5447,50 @@ void CallRegisteredLuaMemHook_LuaMatch(unsigned int address, int size, unsigned
}
void CallRegisteredLuaMenuHandlers(PlatformMenuItem menuItem)
{
std::map<int, LuaContextInfo*>::iterator iter = luaContextInfo.begin();
std::map<int, LuaContextInfo*>::iterator end = luaContextInfo.end();
while(iter != end)
{
LuaContextInfo& info = *iter->second;
lua_State* L = info.L;
if(L && !info.panic)
{
#ifdef USE_INFO_STACK
infoStack.insert(infoStack.begin(), &info);
struct Scope { ~Scope(){ infoStack.erase(infoStack.begin()); } } scope;
#endif
int top = lua_gettop(L);
lua_getfield(L, LUA_REGISTRYINDEX, menuCallbackIDString);
lua_rawgeti(L, -1, menuItem);
if (lua_isfunction(L, -1))
{
bool wasRunning = info.running;
info.running = true;
RefreshScriptSpeedStatus();
int errorcode = lua_pcall(L, 0, 0, 0);
info.running = wasRunning;
RefreshScriptSpeedStatus();
if (errorcode)
{
int uid = iter->first;
HandleCallbackError(L,info,uid,true);
}
break;
}
else
{
lua_pop(L,1);
}
if(!info.crashed)
lua_settop(L, top);
}
++iter;
}
}
bool AnyLuaActive()
{
std::map<int, LuaContextInfo*>::iterator iter = luaContextInfo.begin();

View File

@@ -3,6 +3,12 @@
#include "types.h"
#if defined(WIN32) && !defined(WXPORT)
#include <winsock2.h>
#include <windows.h>
#include "resource.h"
#endif
void OpenLuaContext(int uid, void(*print)(int uid, const char* str) = 0, void(*onstart)(int uid) = 0, void(*onstop)(int uid, bool statusOK) = 0);
void RunLuaScriptFile(int uid, const char* filename);
void StopLuaScript(int uid);
@@ -19,6 +25,7 @@ enum LuaCallID
LUACALL_BEFORESAVE,
LUACALL_AFTERLOAD,
LUACALL_ONSTART,
LUACALL_ONINITMENU,
LUACALL_SCRIPT_HOTKEY_1,
LUACALL_SCRIPT_HOTKEY_2,
@@ -86,6 +93,18 @@ private:
void CallRegisteredLuaSaveFunctions(int savestateNumber, LuaSaveData& saveData);
void CallRegisteredLuaLoadFunctions(int savestateNumber, const LuaSaveData& saveData);
#if defined(WIN32) && !defined(WXPORT)
typedef HMENU PlatformMenu; // hMenu
typedef UINT PlatformMenuItem; // menuId
#define MAX_MENU_COUNT (IDC_LUAMENU_RESERVE_END - IDC_LUAMENU_RESERVE_START + 1)
#else
// TODO: define appropriate types for menu
typedef void* PlatformMenu;
typedef u32 PlatformMenuItem;
#define MAX_MENU_COUNT 0
#endif
void CallRegisteredLuaMenuHandlers(PlatformMenuItem menuItem);
void StopAllLuaScripts();
void RestartAllLuaScripts();
void EnableStopAllLuaScripts(bool enable);

View File

@@ -27,7 +27,7 @@
#else
#include <glib.h>
#endif /* !WXPORT */
#else
#elif !defined(DESMUME_COCOA)
#include <glib.h>
#endif /* _WINDOWS */
@@ -185,6 +185,15 @@ public:
p = pathToModule + lstrlen(pathToModule);
while (p >= pathToModule && *p != '\\') p--;
if (++p >= pathToModule) *p = 0;
#elif defined(DESMUME_COCOA)
std::string pathStr = path;
//Truncate the path from filename
int x = pathStr.find_last_of("/\\");
if (x > 0)
pathStr = pathStr.substr(0, x);
strncpy(pathToModule, pathStr.c_str(), MAX_PATH);
#else
char *cwd = g_build_filename(g_get_user_config_dir(), "desmume", NULL);
g_mkdir_with_parents(cwd, 0755);

View File

@@ -223,16 +223,30 @@ FORCEINLINE edge_fx_fl::edge_fx_fl(int Top, int Bottom, VERT** verts, bool& fail
Y = Ceil28_4((fixed28_4)verts[Top]->y);
int YEnd = Ceil28_4((fixed28_4)verts[Bottom]->y);
Height = YEnd - Y;
X = Ceil28_4((fixed28_4)verts[Top]->x);
int XEnd = Ceil28_4((fixed28_4)verts[Bottom]->x);
int Width = XEnd - X; // can be negative
if(Height)
// even if Height == 0, give some info for horizontal line poly
if(Height != 0 || Width != 0)
{
long dN = long(verts[Bottom]->y - verts[Top]->y);
long dM = long(verts[Bottom]->x - verts[Top]->x);
long InitialNumerator = (long)(dM*16*Y - dM*verts[Top]->y + dN*verts[Top]->x - 1 + dN*16);
FloorDivMod(InitialNumerator,dN*16,X,ErrorTerm,failure);
FloorDivMod(dM*16,dN*16,XStep,Numerator,failure);
Denominator = dN*16;
if (dN != 0)
{
long InitialNumerator = (long)(dM*16*Y - dM*verts[Top]->y + dN*verts[Top]->x - 1 + dN*16);
FloorDivMod(InitialNumerator,dN*16,X,ErrorTerm,failure);
FloorDivMod(dM*16,dN*16,XStep,Numerator,failure);
Denominator = dN*16;
}
else
{
XStep = Width;
Numerator = 0;
ErrorTerm = 0;
Denominator = 1;
dN = 1;
}
float YPrestep = Fixed28_4ToFloat((fixed28_4)(Y*16 - verts[Top]->y));
float XPrestep = Fixed28_4ToFloat((fixed28_4)(X*16 - verts[Top]->x));
@@ -296,6 +310,7 @@ static FORCEINLINE void alphaBlend(FragmentColor & dst, const FragmentColor & sr
}
}
// TODO: wire-frame
struct PolyAttr
{
u32 val;
@@ -687,11 +702,23 @@ public:
}
//draws a single scanline
FORCEINLINE void drawscanline(edge_fx_fl *pLeft, edge_fx_fl *pRight)
FORCEINLINE void drawscanline(edge_fx_fl *pLeft, edge_fx_fl *pRight, bool lineHack)
{
int XStart = pLeft->X;
int width = pRight->X - XStart;
// HACK: workaround for vertical/slant line poly
if (lineHack && width == 0)
{
int leftWidth = pLeft->XStep;
if (pLeft->ErrorTerm + pLeft->Numerator >= pLeft->Denominator)
leftWidth++;
int rightWidth = pRight->XStep;
if (pRight->ErrorTerm + pRight->Numerator >= pRight->Denominator)
rightWidth++;
width = max(1, max(abs(leftWidth), abs(rightWidth)));
}
//these are the starting values, taken from the left edge
float invw = pLeft->invw.curr;
float u = pLeft->u.curr;
@@ -730,15 +757,18 @@ public:
while(width-- > 0)
{
if(RENDERER && (x<0 || x>255)) {
bool outOfRange = false;
if(RENDERER && (x<0 || x>255))
outOfRange = true;
if(!RENDERER && (x<0 || x>=engine->width))
outOfRange = true;
if(!lineHack && outOfRange)
{
printf("rasterizer rendering at x=%d! oops!\n",x);
return;
}
if(!RENDERER && (x<0 || x>=engine->width)) {
printf("rasterizer rendering at x=%d! oops!\n",x);
return;
}
pixel(adr,color[0],color[1],color[2],u,v,1.0f/invw,z);
if(!outOfRange)
pixel(adr,color[0],color[1],color[2],u,v,1.0f/invw,z);
adr++;
x++;
@@ -754,7 +784,7 @@ public:
//runs several scanlines, until an edge is finished
template<bool SLI>
void runscanlines(edge_fx_fl *left, edge_fx_fl *right,bool horizontal)
void runscanlines(edge_fx_fl *left, edge_fx_fl *right, bool horizontal, bool lineHack)
{
//oh lord, hack city for edge drawing
@@ -763,13 +793,21 @@ public:
bool first=true;
static int runctr=0;
runctr++;
//HACK: special handling for horizontal line poly
if (lineHack && left->Height == 0 && right->Height == 0)
{
bool draw = (!SLI || (left->Y & SLI_MASK) == SLI_VALUE);
if(draw) drawscanline(left,right,lineHack);
}
while(Height--) {
bool draw = (!SLI || (left->Y & SLI_MASK) == SLI_VALUE);
if(draw) drawscanline(left,right);
if(draw) drawscanline(left,right,lineHack);
const int xl = left->X;
const int xr = right->X;
const int y = left->Y;
left->Step();
left->Step();
right->Step();
if(!RENDERER && _debug_thisPoly)
@@ -868,7 +906,7 @@ public:
//I didnt reference anything for this algorithm but it seems like I've seen it somewhere before.
//Maybe it is like crow's algorithm
template<bool SLI>
void shape_engine(int type, bool backwards)
void shape_engine(int type, bool backwards, bool lineHack)
{
bool failure = false;
@@ -906,7 +944,7 @@ public:
return;
bool horizontal = left.Y == right.Y;
runscanlines<SLI>(&left,&right,horizontal);
runscanlines<SLI>(&left,&right,horizontal, lineHack);
//if we ran out of an edge, step to the next one
if(right.Height == 0) {
@@ -976,7 +1014,7 @@ public:
polyAttr.backfacing = engine->polyBackfacing[i];
shape_engine<SLI>(type,!polyAttr.backfacing);
shape_engine<SLI>(type,!polyAttr.backfacing, gfx3d_IsLinePoly(poly));
}
}

View File

@@ -131,7 +131,7 @@ SFORMAT SF_ARM9[]={
{ "9LDT", 1, 1, &NDS_ARM9.LDTBit},
{ "9Wai", 4, 1, &NDS_ARM9.waitIRQ},
{ "9hef", 4, 1, &NDS_ARM9.halt_IE_and_IF },
{ "9iws", 1, 1, &NDS_ARM7.intrWaitARM_state },
{ "9iws", 1, 1, &NDS_ARM9.intrWaitARM_state },
{ 0 }
};
@@ -427,7 +427,7 @@ static bool mmu_loadstate(EMUFILE* is, int size)
bool ok = MMU_new.backupDevice.load_state(is);
if(version < 3) return true;
if(version < 3) return ok;
ok &= MMU_new.gxstat.loadstate(is);
@@ -442,7 +442,7 @@ static bool mmu_loadstate(EMUFILE* is, int size)
ok &= MMU_timing.arm9codeCache.loadstate(is, version);
ok &= MMU_timing.arm9dataCache.loadstate(is, version);
if(version < 4) return true;
if(version < 4) return ok;
ok &= MMU_new.sqrt.loadstate(is,version);
ok &= MMU_new.div.loadstate(is,version);

View File

@@ -33,7 +33,6 @@
#include <wctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#include "directory.h"
#include "common.h"
@@ -42,6 +41,15 @@
#include "bit_ops.h"
#include "filetime.h"
#ifdef __APPLE__
//apple doesn't provide strnlen. how unkind
static size_t strnlen(const char *s, size_t n)
{
const char *p = (const char *)memchr(s, 0, n);
return(p ? p-s : n);
}
#endif
// Directory entry codes
#define DIR_ENTRY_LAST 0x00
#define DIR_ENTRY_FREE 0xE5

View File

@@ -30,8 +30,6 @@
#ifndef NDS_DISC_IO_INCLUDE
#define NDS_DISC_IO_INCLUDE
#include "ndstypes.h"
#define FEATURE_MEDIUM_CANREAD 0x00000001
#define FEATURE_MEDIUM_CANWRITE 0x00000002
#define FEATURE_SLOT_GBA 0x00000010

View File

@@ -656,12 +656,9 @@ ssize_t _FAT_write_r (struct _reent *r, intptr_t fd, const char *ptr, size_t len
_FAT_lock(&partition->lock);
// Only write up to the maximum file size, taking into account wrap-around of ints
// <zeromus> first `len` here was changed from `remain` which was a bug due to being used before being defined.
// this was a blind stab in the dark, I didnt think about it much. need to update this file when it is fixed in libnds trunk
if (len + file->filesize > FILE_MAX_SIZE || len + file->filesize < file->filesize) {
len = FILE_MAX_SIZE - file->filesize;
}
remain = len;
// Short circuit cases where len is 0 (or less)
if (len <= 0) {
@@ -669,6 +666,8 @@ ssize_t _FAT_write_r (struct _reent *r, intptr_t fd, const char *ptr, size_t len
return 0;
}
remain = len;
// Get a new cluster for the start of the file if required
if (file->startCluster == CLUSTER_FREE) {
tempNextCluster = _FAT_fat_linkFreeCluster (partition, CLUSTER_FREE);

View File

@@ -63,7 +63,11 @@ struct _reent {
intptr_t _errno;
};
#ifdef __APPLE__
typedef __darwin_mode_t mode_t;
#else
typedef uint32_t mode_t;
#endif
struct DIR_ITER {
void* dirStruct;

View File

@@ -31,7 +31,7 @@
#ifndef _MEM_ALLOCATE_H
#define _MEM_ALLOCATE_H
#include <malloc.h>
#include <stdlib.h>
static inline void* _FAT_mem_allocate (size_t size) {
return malloc (size);

View File

@@ -83,8 +83,8 @@
#define DESMUME_COMPILER_DETAIL ""
#endif
#define DESMUME_VERSION_NUMERIC 90600
#define DESMUME_VERSION_STRING " " "0.9.6" DESMUME_SUBVERSION_STRING DESMUME_FEATURE_STRING DESMUME_PLATFORM_STRING DESMUME_CPUEXT_STRING DESMUME_COMPILER
#define DESMUME_VERSION_NUMERIC 90700
#define DESMUME_VERSION_STRING " " "0.9.7" DESMUME_SUBVERSION_STRING DESMUME_FEATURE_STRING DESMUME_PLATFORM_STRING DESMUME_CPUEXT_STRING DESMUME_COMPILER
#define DESMUME_NAME_AND_VERSION DESMUME_NAME DESMUME_VERSION_STRING
u32 EMU_DESMUME_VERSION_NUMERIC() { return DESMUME_VERSION_NUMERIC; }

View File

@@ -18,7 +18,7 @@
*/
#include <string>
#include <types.h>
#include "types.h"
u32 EMU_DESMUME_VERSION_NUMERIC();
const char* EMU_DESMUME_VERSION_STRING();

View File

@@ -81,10 +81,11 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-Win32.lib glib-vc8-Win32.lib lua-vc8-Win32-debug.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 Rpcrt4.lib"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-Win32.lib glib-vc8-Win32.lib lua51.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 Rpcrt4.lib"
OutputFile="$(OutDir)\$(ProjectName)_debug.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
AdditionalLibraryDirectories=".\zlib123;agg;.libs;.libs\win32"
IgnoreDefaultLibraryNames="LIBCPMT"
DelayLoadDLLs="lua51.dll"
GenerateDebugInformation="true"
GenerateMapFile="true"
OptimizeReferences="2"
@@ -174,9 +175,10 @@
/>
<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 lua51.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"
OutputFile="$(OutDir)\$(ProjectName)_x64_debug.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
AdditionalLibraryDirectories=".\zlib123;agg;.libs;.libs\x64"
DelayLoadDLLs="lua51.dll"
GenerateDebugInformation="true"
GenerateMapFile="true"
OptimizeReferences="2"
@@ -272,9 +274,10 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-Win32.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 Rpcrt4.lib"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-Win32.lib lua51.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 Rpcrt4.lib"
OutputFile="$(OutDir)\$(ProjectName)_release.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
AdditionalLibraryDirectories=".\zlib123;agg;.libs;.libs\win32"
DelayLoadDLLs="lua51.dll"
GenerateDebugInformation="true"
GenerateMapFile="true"
EnableCOMDATFolding="0"
@@ -370,9 +373,10 @@
/>
<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 lua-5.1.4-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 lua51.lib glib-vc8-x64.lib 7z-vc8-x64.lib zlib-vc8-x64.lib agg-2.5-x64.lib lua-5.1.4-x64.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_x64_release.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
AdditionalLibraryDirectories=".\zlib123;agg;.libs;.libs\x64"
DelayLoadDLLs="lua51.dll"
GenerateDebugInformation="true"
GenerateMapFile="true"
EnableCOMDATFolding="0"
@@ -470,9 +474,10 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-Win32.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 comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib Rpcrt4.lib"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-Win32.lib lua51.lib glib-vc8-Win32.lib 7z-vc8-Win32.lib zlib-vc8-Win32.lib agg-2.5.lib vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib shell32.lib comdlg32.lib shlwapi.lib Rpcrt4.lib"
OutputFile="$(OutDir)\$(ProjectName)_releaseFastBuild.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
AdditionalLibraryDirectories=".\zlib123;agg;.libs;.libs\win32"
DelayLoadDLLs="lua51.dll"
GenerateDebugInformation="true"
GenerateMapFile="true"
OptimizeReferences="2"
@@ -571,9 +576,10 @@
/>
<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 lua51.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"
OutputFile="$(OutDir)\$(ProjectName)_x64_releaseFastBuild.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
AdditionalLibraryDirectories=".\zlib123;agg;.libs;.libs\x64"
DelayLoadDLLs="lua51.dll"
GenerateDebugInformation="true"
GenerateMapFile="true"
OptimizeReferences="2"
@@ -1592,10 +1598,6 @@
RelativePath="..\utils\libfat\mem_allocate.h"
>
</File>
<File
RelativePath="..\utils\libfat\ndstypes.h"
>
</File>
<File
RelativePath="..\utils\libfat\partition.cpp"
>

View File

@@ -78,10 +78,10 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-Win32.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="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-Win32.lib lua51.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"
OutputFile="$(OutDir)\$(ProjectName)_debug.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
DelayLoadDLLs=""
AdditionalLibraryDirectories=".\zlib123;agg;.libs;.libs\win32"
DelayLoadDLLs="lua51.dll"
GenerateDebugInformation="true"
GenerateMapFile="true"
RandomizedBaseAddress="1"
@@ -167,9 +167,10 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-x64.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 libelf_libdwarf-vc8-x64.lib lua51.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"
OutputFile="$(OutDir)\$(ProjectName)_x64_debug.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
AdditionalLibraryDirectories=".\zlib123;agg;.libs;.libs\x64"
DelayLoadDLLs="lua51.dll"
GenerateDebugInformation="true"
GenerateMapFile="true"
RandomizedBaseAddress="1"
@@ -260,10 +261,10 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-Win32.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="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-Win32.lib lua51.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"
OutputFile="$(OutDir)\$(ProjectName)_release.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
DelayLoadDLLs=""
AdditionalLibraryDirectories=".\zlib123;agg;.libs;.libs\win32"
DelayLoadDLLs="lua51.dll"
GenerateDebugInformation="true"
OptimizeReferences="2"
RandomizedBaseAddress="1"
@@ -354,9 +355,10 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-x64.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 libelf_libdwarf-vc8-x64.lib lua51.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"
OutputFile="$(OutDir)\$(ProjectName)_x64_release.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
AdditionalLibraryDirectories=".\zlib123;agg;.libs;.libs\x64"
DelayLoadDLLs="lua51.dll"
GenerateDebugInformation="true"
OptimizeReferences="2"
RandomizedBaseAddress="1"
@@ -447,10 +449,10 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-Win32.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="directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-Win32.lib lua51.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"
OutputFile="$(OutDir)\$(ProjectName)_dev+.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
DelayLoadDLLs=""
AdditionalLibraryDirectories=".\zlib123;agg;.libs;.libs\win32"
DelayLoadDLLs="lua51.dll"
GenerateDebugInformation="true"
OptimizeReferences="2"
LinkTimeCodeGeneration="0"
@@ -542,9 +544,10 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib libelf_libdwarf-vc8-x64.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 libelf_libdwarf-vc8-x64.lib lua51.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"
OutputFile="$(OutDir)\$(ProjectName)_x64_dev+.exe"
AdditionalLibraryDirectories=".\zlib123;agg;.libs"
AdditionalLibraryDirectories=".\zlib123;agg;.libs;.libs\x64"
DelayLoadDLLs="lua51.dll"
GenerateDebugInformation="true"
OptimizeReferences="2"
LinkTimeCodeGeneration="0"
@@ -1233,10 +1236,6 @@
RelativePath="..\utils\libfat\mem_allocate.h"
>
</File>
<File
RelativePath="..\utils\libfat\ndstypes.h"
>
</File>
<File
RelativePath="..\utils\libfat\partition.cpp"
>

View File

@@ -155,7 +155,9 @@
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectName)_x64_release</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Dev+|x64'">$(ProjectName)_x64_dev+</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)_x64_debug</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName)</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName)_release</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Dev+|Win32'">$(ProjectName)_dev+</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)_debug</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
@@ -181,10 +183,10 @@
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>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)</AdditionalDependencies>
<AdditionalDependencies>directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib;lua51.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)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName)_debug.exe</OutputFile>
<AdditionalLibraryDirectories>.\zlib123;agg;.libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalLibraryDirectories>.\zlib123;agg;.libs;.libs\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>lua51.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
@@ -208,7 +210,7 @@
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<WholeProgramOptimization>true</WholeProgramOptimization>
<AdditionalIncludeDirectories>.;..;lua\include;glib-2.20.1\build;glib-2.20.1\build\glib;.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig;.\7z;.\agg\include;.\agg\examples;.\wx\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;GLIB_STATIC_COMPILATION;WIN32;HAVE_LIBZ;NOMINMAX;RELEASE;NDEBUG;EXPERIMENTAL_WIFI_COMM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;GLIB_STATIC_COMPILATION;WIN32;HAVE_LIBZ;NOMINMAX;RELEASE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<StructMemberAlignment>Default</StructMemberAlignment>
@@ -226,10 +228,10 @@
<CreateHotpatchableImage>false</CreateHotpatchableImage>
</ClCompile>
<Link>
<AdditionalDependencies>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)</AdditionalDependencies>
<AdditionalDependencies>directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib;lua51.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)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName)_release.exe</OutputFile>
<AdditionalLibraryDirectories>.\zlib123;agg;.libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalLibraryDirectories>.\zlib123;agg;.libs;.libs\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>lua51.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
@@ -254,7 +256,7 @@
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>.;..;lua\include;glib-2.20.1\build;glib-2.20.1\build\glib;.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig;.\7z;.\agg\include;.\agg\examples;.\wx\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;GLIB_STATIC_COMPILATION;WIN32;HAVE_LIBZ;NOMINMAX;RELEASE;NDEBUG;FASTBUILD;DEVELOPER;EXPERIMENTAL_WIFI_COMM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;GLIB_STATIC_COMPILATION;WIN32;HAVE_LIBZ;NOMINMAX;RELEASE;NDEBUG;FASTBUILD;DEVELOPER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<StructMemberAlignment>Default</StructMemberAlignment>
@@ -271,10 +273,10 @@
<CreateHotpatchableImage>false</CreateHotpatchableImage>
</ClCompile>
<Link>
<AdditionalDependencies>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)</AdditionalDependencies>
<AdditionalDependencies>directx-win32-ddraw-dinput8-dsound-dxerr8-dxguid.lib;lua51.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)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName)_dev+.exe</OutputFile>
<AdditionalLibraryDirectories>.\zlib123;agg;.libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalLibraryDirectories>.\zlib123;agg;.libs;.libs\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>lua51.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OptimizeReferences>true</OptimizeReferences>
<LinkTimeCodeGeneration>
@@ -315,10 +317,10 @@
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<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)</AdditionalDependencies>
<AdditionalDependencies>directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib;lua51.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)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName)_x64_debug.exe</OutputFile>
<AdditionalLibraryDirectories>.\zlib123;agg;.libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalLibraryDirectories>.\zlib123;agg;.libs;.libs\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>wpcap.dll;lua51.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
@@ -360,10 +362,10 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<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)</AdditionalDependencies>
<AdditionalDependencies>directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib;lua51.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)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName)_x64_release.exe</OutputFile>
<AdditionalLibraryDirectories>.\zlib123;agg;.libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalLibraryDirectories>.\zlib123;agg;.libs;.libs\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>wpcap.dll;lua51.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
@@ -406,10 +408,10 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<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)</AdditionalDependencies>
<AdditionalDependencies>directx-x64-ddraw-dinput8-dsound-dxerr8-dxguid.lib;lua51.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)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName)_x64_dev+.exe</OutputFile>
<AdditionalLibraryDirectories>.\zlib123;agg;.libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>wpcap.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<AdditionalLibraryDirectories>.\zlib123;agg;.libs;.libs\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>wpcap.dll;lua51.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<OptimizeReferences>true</OptimizeReferences>
<LinkTimeCodeGeneration>
@@ -621,7 +623,6 @@
<ClInclude Include="..\utils\libfat\libfat_public_api.h" />
<ClInclude Include="..\utils\libfat\lock.h" />
<ClInclude Include="..\utils\libfat\mem_allocate.h" />
<ClInclude Include="..\utils\libfat\ndstypes.h" />
<ClInclude Include="..\utils\libfat\partition.h" />
<ClInclude Include="..\version.h" />
<ClInclude Include="..\wifi.h" />

View File

@@ -771,9 +771,6 @@
<ClInclude Include="..\utils\datetime.h">
<Filter>Core\utils</Filter>
</ClInclude>
<ClInclude Include="..\utils\libfat\ndstypes.h">
<Filter>Core\utils\libfat</Filter>
</ClInclude>
<ClInclude Include="..\utils\libfat\partition.h">
<Filter>Core\utils\libfat</Filter>
</ClInclude>

View File

@@ -25,7 +25,6 @@
///////////////////////////////////////////////////////////////// Console
#if !defined(PUBLIC_RELEASE) || defined(DEVELOPER)
#define BUFFER_SIZE 100
HANDLE hConsole = NULL;
void printlog(const char *fmt, ...);
@@ -117,9 +116,3 @@ void printlog(const char *fmt, ...)
va_end(list);
WriteConsole(hConsole,msg, (DWORD)strlen(msg), &tmp, 0);
}
#else
void OpenConsole() {}
void CloseConsole() {}
#endif

View File

@@ -21,6 +21,7 @@
#include "hotkey.h"
#include "main.h"
#include "CheatsWin.h"
#include "NDSSystem.h"
#include "saves.h"
#include "inputdx.h"
@@ -91,6 +92,11 @@ void HK_ReloadROM(int, bool justPressed)
void OpenRecentROM(int listNum);
OpenRecentROM(0);
}
void HK_SearchCheats(int, bool justPressed)
{
if (romloaded)
CheatsSearchDialog(MainWindow->getHWnd());
}
void HK_QuickScreenShot(int param, bool justPressed)
{
char buffer[MAX_PATH];
@@ -703,6 +709,13 @@ void InitCustomKeys (SCustomKeys *keys)
keys->LCDsSwap.page = HOTKEY_PAGE_MOVIE;
keys->LCDsSwap.key = VK_NEXT;
keys->SearchCheats.handleKeyDown = HK_SearchCheats;
keys->SearchCheats.code = "SearchCheats";
keys->SearchCheats.name = STRW(ID_LABEL_HK54);
keys->SearchCheats.page = HOTKEY_PAGE_MOVIE;
keys->SearchCheats.key = 'S';
keys->SearchCheats.modifiers = CUSTKEY_CTRL_MASK;
keys->IncreaseVolume.handleKeyDown = HK_IncreaseVolume;
keys->IncreaseVolume.code = "IncreaseVolume";
keys->IncreaseVolume.name = STRW(ID_LABEL_HK32);

View File

@@ -94,6 +94,7 @@ struct SCustomKeys
SCustomKey StylusAutoHold;
SCustomKey LCDsMode;
SCustomKey LCDsSwap;
SCustomKey SearchCheats;
SCustomKey IncreaseVolume;
SCustomKey DecreaseVolume;
SCustomKey LastItem; // dummy, must be last

Binary file not shown.

View File

@@ -631,13 +631,14 @@ LRESULT CALLBACK LuaScriptProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
char LogicalName[1024], PhysicalName[1024];
bool exists = ObtainFile(Str_Tmp, LogicalName, PhysicalName, "luarun", s_nonLuaExtensions, sizeof(s_nonLuaExtensions)/sizeof(*s_nonLuaExtensions));
Update_Recent_Script(LogicalName, info.subservient);
RunLuaScriptFile((int)hDlg, PhysicalName);
if(DemandLua())
RunLuaScriptFile((int)hDlg, PhysicalName);
} break;
case IDC_BUTTON_LUASTOP:
{
PrintToWindowConsole((int)hDlg, "user clicked stop button\r\n");
SetActiveWindow(MainWindow->getHWnd());
StopLuaScript((int)hDlg);
if(DemandLua()) StopLuaScript((int)hDlg);
} break;
case IDC_NOTIFY_SUBSERVIENT:
{

View File

@@ -2128,6 +2128,18 @@ void
joinThread_gdb( void *thread_handle) {
}
bool DemandLua()
{
HMODULE mod = LoadLibrary("lua51.dll");
if(!mod)
{
MessageBox(NULL, "lua51.dll was not found. Please get it into your PATH or in the same directory as desmume.exe", "DeSmuME", MB_OK | MB_ICONERROR);
return false;
}
FreeLibrary(mod);
return true;
}
int MenuInit()
{
@@ -2541,8 +2553,6 @@ int _main()
char text[80];
GetINIPath();
path.ReadPathSettings();
CommonSettings.cheatsDisable = GetPrivateProfileBool("General", "cheatsDisable", false, IniName);
@@ -3035,7 +3045,17 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
g_thread_init (NULL);
hAppInst=hThisInstance;
OpenConsole(); // Init debug console
GetINIPath();
#if !defined(PUBLIC_RELEASE) || defined(DEVELOPER)
static const bool defaultConsoleEnable = true;
#else
static const bool defaultConsoleEnable = false;
#endif
if(GetPrivateProfileBool("Display", "Show Console", defaultConsoleEnable, IniName))
OpenConsole(); // Init debug console
int ret = _main();
@@ -4038,6 +4058,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
UpdateHotkeyAssignments(); //Add current hotkey mappings to menu item names
CallRegisteredLuaFunctions(LUACALL_ONINITMENU);
return 0;
}
@@ -4603,6 +4625,12 @@ DOKEYDOWN:
return 0;
}
if(wParam >= IDC_LUAMENU_RESERVE_START &&
wParam <= IDC_LUAMENU_RESERVE_END)
{
CallRegisteredLuaMenuHandlers(wParam);
return 0;
}
}
switch(LOWORD(wParam))
{
@@ -5369,6 +5397,11 @@ DOKEYDOWN:
ScaleScreen(windowSize, true);
WritePrivateProfileInt("Video","Window Size",windowSize,IniName);
break;
case IDC_WINDOW5X:
windowSize=5;
ScaleScreen(windowSize, true);
WritePrivateProfileInt("Video","Window Size",windowSize,IniName);
break;
case IDC_FORCERATIO:
if (ForceRatio) {

View File

@@ -22,6 +22,7 @@ void AviEnd();
void WavRecordTo(int wavmode);
void WavEnd();
void UpdateToolWindows();
bool DemandLua();
extern bool frameCounterDisplay;
extern bool FpsDisplay;

View File

@@ -29,6 +29,7 @@
#include <windowsx.h>
#include <commctrl.h>
#include "memView.h"
#include "winutil.h"
using namespace std;
@@ -390,6 +391,8 @@ LRESULT MemView_ViewBoxPaint(CMemView* wnd, HWND hCtl, WPARAM wParam, LPARAM lPa
{
case 0:
{
SetDlgItemText(wnd->hWnd,IDC_2012,"");
curx += (fontsize.cx * 2);
for(i = 0; i < 16; i++)
{
@@ -422,10 +425,19 @@ LRESULT MemView_ViewBoxPaint(CMemView* wnd, HWND hCtl, WPARAM wParam, LPARAM lPa
case 1:
{
SetDlgItemText(wnd->hWnd,IDC_2012,"");
curx += (fontsize.cx * 6);
for(i = 0; i < 16; i += 2)
{
u16 val = T1ReadWord(memory, ((line << 4) + i));
if(IsDlgCheckboxChecked(wnd->hWnd,IDC_BIG_ENDIAN))
{
char swp[2];
swp[0] = (val>>8)&0xFF;
swp[1] = val&0xFF;
val = *(u16*)swp;
}
if(wnd->sel && (wnd->selAddress == (addr + i)))
{
SetBkColor(mem_hdc, GetSysColor(COLOR_HIGHLIGHT));
@@ -456,10 +468,25 @@ LRESULT MemView_ViewBoxPaint(CMemView* wnd, HWND hCtl, WPARAM wParam, LPARAM lPa
case 2:
{
u8 smallbuf[4];
MMU_DumpMemBlock(wnd->cpu, wnd->selAddress, 4, smallbuf);
char textbuf[32];
sprintf(textbuf,"%f",((s32)T1ReadLong(smallbuf,0))/4096.0f);
SetDlgItemText(wnd->hWnd,IDC_2012,textbuf);
curx += (fontsize.cx * 8);
for(i = 0; i < 16; i += 4)
{
u32 val = T1ReadLong(memory, ((line << 4) + i));
if(IsDlgCheckboxChecked(wnd->hWnd,IDC_BIG_ENDIAN))
{
char swp[4];
swp[0] = (val>>24)&0xFF;
swp[1] = (val>>16)&0xFF;
swp[2] = (val>>8)&0xFF;
swp[3] = val&0xFF;
val = *(u32*)swp;
}
if(wnd->sel && (wnd->selAddress == (addr + i)))
{
SetBkColor(mem_hdc, GetSysColor(COLOR_HIGHLIGHT));
@@ -604,7 +631,6 @@ LRESULT CALLBACK MemView_ViewBoxProc(HWND hCtl, UINT uMsg, WPARAM wParam, LPARAM
col = ((x - (fontsize.cx * 8)) / (fontsize.cx * (8+1)) * 4);
wnd->sel = TRUE;
}
break;
}
@@ -612,6 +638,7 @@ LRESULT CALLBACK MemView_ViewBoxProc(HWND hCtl, UINT uMsg, WPARAM wParam, LPARAM
wnd->selAddress = (wnd->address + (line << 4) + col);
wnd->selPart = 0;
wnd->selNewVal = 0x00000000;
}
SelectObject(hdc, font);

View File

@@ -230,7 +230,7 @@ void CalculateItemIndices(int itemSize)
}
template<typename stepType, typename compareType, int swapXOR>
void UpdateRegionT(const MemoryRegion& region, const MemoryRegion* nextRegionPtr)
void UpdateRegionT(const MemoryRegion& region, const MemoryRegion* nextRegionPtr, bool updateNumChanges)
{
if(s_prevValuesNeedUpdate)
memcpy(buffers->s_prevValues + region.virtualIndex, buffers->s_curValues + region.virtualIndex, region.size + sizeof(compareType) - sizeof(stepType));
@@ -249,6 +249,7 @@ void UpdateRegionT(const MemoryRegion& region, const MemoryRegion* nextRegionPtr
{
buffers->s_curValues[i] = sourceAddr[i^swapXOR]; // update value
//if(s_numChanges[i] != 0xFFFF)
if(updateNumChanges)
buffers->s_numChanges[i]++; // increase change count
}
}
@@ -288,6 +289,7 @@ void UpdateRegionT(const MemoryRegion& region, const MemoryRegion* nextRegionPtr
if(nextValidChange[m] <= i) // if we didn't already increase the change count for this entry
{
//if(s_numChanges[i-k] != 0xFFFF)
if(updateNumChanges)
buffers->s_numChanges[i-k]++; // increase the change count for this entry
nextValidChange[m] = i-k+sizeof(compareType); // and remember not to increase it again
}
@@ -298,7 +300,7 @@ void UpdateRegionT(const MemoryRegion& region, const MemoryRegion* nextRegionPtr
}
template<typename stepType, typename compareType>
void UpdateRegionsT()
void UpdateRegionsT(bool updateNumChanges)
{
for(MemoryList::iterator iter = s_activeMemoryRegions.begin(); iter != s_activeMemoryRegions.end();)
{
@@ -307,9 +309,9 @@ void UpdateRegionsT()
const MemoryRegion* nextRegion = (iter == s_activeMemoryRegions.end()) ? NULL : &*iter;
//if(region.byteSwapped)
// UpdateRegionT<stepType, compareType, 1>(region, nextRegion);
// UpdateRegionT<stepType, compareType, 1>(region, nextRegion, updateNumChanges);
//else
UpdateRegionT<stepType, compareType, 0>(region, nextRegion);
UpdateRegionT<stepType, compareType, 0>(region, nextRegion, updateNumChanges);
}
s_prevValuesNeedUpdate = false;
@@ -997,13 +999,22 @@ void CompactAddrs()
ListView_SetItemCount(GetDlgItem(RamSearchHWnd,IDC_RAMLIST),ResultCount);
}
void soft_reset_address_info (bool resetPrevValues = false)
void soft_reset_address_info ()
{
if (resetPrevValues) {
memcpy(buffers->s_prevValues, buffers->s_curValues, sizeof(buffers->s_prevValues));
s_prevValuesNeedUpdate = false;
}
s_prevValuesNeedUpdate = false;
ResetMemoryRegions();
if(!RamSearchHWnd)
{
s_activeMemoryRegions.clear();
ResultCount = 0;
}
else
{
// force s_prevValues to be valid
signal_new_frame();
s_prevValuesNeedUpdate = true;
signal_new_frame();
}
memset(buffers->s_numChanges, 0, sizeof(buffers->s_numChanges));
CompactAddrs();
}
@@ -1030,9 +1041,9 @@ void reset_address_info ()
CompactAddrs();
}
void signal_new_frame ()
void signal_new_frame (bool updateNumChanges)
{
CALL_WITH_T_SIZE_TYPES(UpdateRegionsT, rs_type_size,rs_t=='s',noMisalign);
CALL_WITH_T_SIZE_TYPES(UpdateRegionsT, rs_type_size,rs_t=='s',noMisalign,updateNumChanges);
}
@@ -1107,6 +1118,12 @@ void signal_new_size ()
rs_last_type_size = rs_type_size;
rs_last_no_misalign = noMisalign;
if(newSize > oldSize)
{
// update hidden bytes
signal_new_frame(false);
}
if(numberOfItemsChanged)
{
// restore selection ranges
@@ -1202,6 +1219,7 @@ void Update_RAM_Search() //keeps RAM values up to date in the search and watch w
// if(disableRamSearchUpdate)
// return;
int prevValuesNeededUpdate;
if (AutoSearch && !ResultCount)
{
if(!AutoSearchAutoRetry)
@@ -1217,22 +1235,25 @@ void Update_RAM_Search() //keeps RAM values up to date in the search and watch w
AutoSearchAutoRetry = true;
}
reset_address_info();
prevValuesNeededUpdate = s_prevValuesNeedUpdate;
}
int prevValuesNeededUpdate = s_prevValuesNeedUpdate;
if (RamSearchHWnd)
else
{
// update active RAM values
signal_new_frame();
}
prevValuesNeededUpdate = s_prevValuesNeedUpdate;
if (RamSearchHWnd)
{
// update active RAM values
signal_new_frame();
}
if (AutoSearch && ResultCount)
{
//Clear_Sound_Buffer();
if(!rs_val_valid)
rs_val_valid = Set_RS_Val();
if(rs_val_valid)
prune(rs_c,rs_o,rs_t=='s',rs_val,rs_param);
if (AutoSearch && ResultCount)
{
//Clear_Sound_Buffer();
if(!rs_val_valid)
rs_val_valid = Set_RS_Val();
if(rs_val_valid)
prune(rs_c,rs_o,rs_t=='s',rs_val,rs_param);
}
}
if(RamSearchHWnd)
@@ -1703,7 +1724,7 @@ LRESULT CALLBACK RamSearchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
RamSearchSaveUndoStateIfNotTooBig(RamSearchHWnd);
int prevNumItems = last_rs_possible;
soft_reset_address_info(true);
soft_reset_address_info();
if(prevNumItems == last_rs_possible)
SetRamSearchUndoType(RamSearchHWnd, 0); // nothing to undo

View File

@@ -35,7 +35,7 @@ unsigned int GetRamValue(unsigned int Addr,char Size);
void prune(char Search, char Operater, char Type, int Value, int OperatorParameter);
void CompactAddrs();
void reset_address_info();
void signal_new_frame();
void signal_new_frame(bool updateNumChanges = true);
void signal_new_size();
void UpdateRamSearchTitleBar(int percent = 0);
void Update_RAM_Search();

View File

@@ -683,6 +683,9 @@ LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
case 'h':
SendDlgItemMessage(hDlg, IDC_HEX, BM_SETCHECK, BST_CHECKED, 0);
break;
case 'f':
SendDlgItemMessage(hDlg, IDC_2012, BM_SETCHECK, BST_CHECKED, 0);
break;
default:
t = 0;
break;
@@ -703,6 +706,9 @@ LRESULT CALLBACK EditWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
case IDC_HEX:
t='h';
return true;
case IDC_2012:
t='f';
return true;
case IDC_1_BYTE:
s = 'b';
return true;
@@ -814,7 +820,6 @@ void RefreshWatchListSelectedCountControlStatus(HWND hDlg)
{
RamWatchEnableCommand(hDlg, ramwatchmenu, IDC_C_WATCH_EDIT, selCount == 1);
RamWatchEnableCommand(hDlg, ramwatchmenu, IDC_C_WATCH_REMOVE, selCount >= 1);
RamWatchEnableCommand(hDlg, ramwatchmenu, IDC_C_WATCH, selCount == 1);
RamWatchEnableCommand(hDlg, ramwatchmenu, IDC_C_WATCH_DUPLICATE, selCount == 1);
RamWatchEnableCommand(hDlg, ramwatchmenu, IDC_C_ADDCHEAT, selCount == 1);
RamWatchEnableCommand(hDlg, ramwatchmenu, ID_WATCHES_UPDOWN, selCount == 1);
@@ -967,13 +972,18 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
int t = rswatches[iNum].Type;
int size = rswatches[iNum].Size;
const char* formatString = ((t=='s') ? "%d" : (t=='u') ? "%u" : (size=='d' ? "%08X" : size=='w' ? "%04X" : "%02X"));
switch (size)
if(t=='f')
{
case 'b':
default: sprintf(num, formatString, t=='s' ? (char)(i&0xff) : (unsigned char)(i&0xff)); break;
case 'w': sprintf(num, formatString, t=='s' ? (short)(i&0xffff) : (unsigned short)(i&0xffff)); break;
case 'd': sprintf(num, formatString, t=='s' ? (long)(i&0xffffffff) : (unsigned long)(i&0xffffffff)); break;
sprintf(num,"%f",i/4096.0f);
}
else
switch (size)
{
case 'b':
default: sprintf(num, formatString, t=='s' ? (char)(i&0xff) : (unsigned char)(i&0xff)); break;
case 'w': sprintf(num, formatString, t=='s' ? (short)(i&0xffff) : (unsigned short)(i&0xffff)); break;
case 'd': sprintf(num, formatString, t=='s' ? (long)(i&0xffffffff) : (unsigned long)(i&0xffffffff)); break;
}
Item->item.pszText = num;
} return true;
@@ -1077,6 +1087,7 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
memcpy(&(rswatches[watchIndex]),&(rswatches[watchIndex - 1]),sizeof(AddressWatcher));
memcpy(&(rswatches[watchIndex - 1]),tmp,sizeof(AddressWatcher));
free(tmp);
ListView_SetItemState(GetDlgItem(hDlg,IDC_WATCHLIST),watchIndex,0,LVIS_FOCUSED|LVIS_SELECTED);
ListView_SetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST),watchIndex-1);
ListView_SetItemState(GetDlgItem(hDlg,IDC_WATCHLIST),watchIndex-1,LVIS_FOCUSED|LVIS_SELECTED,LVIS_FOCUSED|LVIS_SELECTED);
ListView_SetItemCount(GetDlgItem(hDlg,IDC_WATCHLIST),WatchCount);
@@ -1093,6 +1104,7 @@ LRESULT CALLBACK RamWatchProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
memcpy(&(rswatches[watchIndex]),&(rswatches[watchIndex + 1]),sizeof(AddressWatcher));
memcpy(&(rswatches[watchIndex + 1]),tmp,sizeof(AddressWatcher));
free(tmp);
ListView_SetItemState(GetDlgItem(hDlg,IDC_WATCHLIST),watchIndex,0,LVIS_FOCUSED|LVIS_SELECTED);
ListView_SetSelectionMark(GetDlgItem(hDlg,IDC_WATCHLIST),watchIndex+1);
ListView_SetItemState(GetDlgItem(hDlg,IDC_WATCHLIST),watchIndex+1,LVIS_FOCUSED|LVIS_SELECTED,LVIS_FOCUSED|LVIS_SELECTED);
ListView_SetItemCount(GetDlgItem(hDlg,IDC_WATCHLIST),WatchCount);

View File

@@ -248,6 +248,7 @@
#define IDC_2_BYTES 958
#define IDC_4_BYTES 959
#define IDC_WATCHLIST 960
#define IDC_HEX2 960
#define IDC_C_WATCH_EDIT 961
#define IDC_C_WATCH_REMOVE 962
#define IDC_C_WATCH 963
@@ -386,6 +387,7 @@
#define IDC_RFILE 1038
#define IDC_EXPORT 1038
#define IDC_RFOLDER 1039
#define IDC_2012 1039
#define IDC_BBROWSE2 1040
#define IDC_PATHDESMUME 1041
#define IDC_BRESTART 1042
@@ -432,6 +434,7 @@
#define IDC_CAP0_ACTIVE 1078
#define IDC_CHECK10 1079
#define IDC_CAP0_RUNNING 1079
#define IDC_BIG_ENDIAN 1079
#define IDC_CHECK6 1080
#define IDC_CAP1_SRC 1080
#define IDC_CAP1_ONESHOT 1081
@@ -450,6 +453,7 @@
#define IDC_EDIT1 1102
#define IDC_EDIT2 1103
#define IDC_EDIT3 1104
#define IDC_WINDOW5X 1105
#define IDC_EDIT_AUTHOR 1180
#define IDD_MATRIX_VIEWER 1200
#define IDM_MATRIX_VIEWER 1200
@@ -688,6 +692,8 @@
#define MENU_PRINCIPAL 2012
#define RAMWATCH_MENU 2013
#define RECENTROMS 2014
#define IDD_FONTSETTINGS 2464
#define IDC_FONTCOMBO 2465
#define IDC_GI_FATOFS 4464
#define IDC_INTERPOLATECOLOR 4464
#define IDC_GI_FATSIZE 4465
@@ -771,6 +777,7 @@
#define ID_LABEL_HK52 4516
#define ID_LABEL_HK53 4517
#define ID_LABEL_HK13b 4518
#define ID_LABEL_HK54 4519
#define IDD_MICROPHONE 5000
#define IDM_MICROPHONESETTINGS 5001
#define IDC_MICSAMPLEBROWSE 5003
@@ -780,12 +787,8 @@
#define IDC_USENOISE 5010
#define IDC_CPU 6000
#define IDC_IOREG 6001
//ZELDA SHADOW HACK
#define ID_LABEL_ZELDA_SHADOW_DEPTH_HACK 9000
#define IDC_ZELDA_SHADOW_DEPTH_HACK 9001
#define ID_LABEL_ZELDA_SHADOW_DEPTH_HACK 9000
#define IDC_ZELDA_SHADOW_DEPTH_HACK 9001
#define IDD_CHEAT_ADD_XX_CODE 10005
#define IDD_GBASLOT_GUITARGRIP 10009
#define IDD_GBASLOT_PIANO 10010
@@ -898,7 +901,9 @@
#define IDC_LUASCRIPT_RESERVE_END 58099
#define IDD_LUARECENT_RESERVE_START 58100
#define IDD_LUARECENT_RESERVE_END 58199
#define IDC_FRAMEADVANCE 58200
#define IDC_LUAMENU_RESERVE_START 58200
#define IDC_LUAMENU_RESERVE_END 58399
#define IDC_FRAMEADVANCE 58400
#define IDC_LABEL_HK1 60001
#define IDC_LABEL_HK2 60002
#define IDC_LABEL_HK3 60003
@@ -953,7 +958,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 123
#define _APS_NEXT_COMMAND_VALUE 40085
#define _APS_NEXT_CONTROL_VALUE 1039
#define _APS_NEXT_CONTROL_VALUE 1040
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

Binary file not shown.