From 6e19a21fc4b349f72506f8c7c039cbbfccec3603 Mon Sep 17 00:00:00 2001 From: mtufan Date: Wed, 8 Jun 2011 17:11:07 +0300 Subject: [PATCH] puae 2.3.2 --- src/gfxutil.c | 2 +- src/gui-cocoa/cocoaui.m | 48 +++++++++++++---------------------------- src/include/xwin.h | 3 ++- 3 files changed, 18 insertions(+), 35 deletions(-) diff --git a/src/gfxutil.c b/src/gfxutil.c index 2d75742..6373edd 100644 --- a/src/gfxutil.c +++ b/src/gfxutil.c @@ -16,7 +16,7 @@ #include "uae_endian.h" -int getvsyncrate (int hz) +double getvsyncrate (double hz) { if (hz > 85) return hz / 2; diff --git a/src/gui-cocoa/cocoaui.m b/src/gui-cocoa/cocoaui.m index dcd5b1e..7570484 100644 --- a/src/gui-cocoa/cocoaui.m +++ b/src/gui-cocoa/cocoaui.m @@ -95,7 +95,6 @@ extern NSString *getApplicationName(void); /* Prototypes */ int ensureNotFullscreen (void); void restoreFullscreen (void); -void lossyASCIICopy (char *buffer, NSString *source, size_t maxLength); /* Globals */ static BOOL wasFullscreen = NO; // used by ensureNotFullscreen() and restoreFullscreen() @@ -1078,8 +1077,9 @@ static BOOL wasFullscreen = NO; // used by ensureNotFullscreen() and restoreFull if ((drive >= 0) && (drive < 4)) { NSArray *files = [sheet filenames]; NSString *file = [files objectAtIndex:0]; - - lossyASCIICopy (changed_prefs.floppyslots[drive].df, file, COCOA_GUI_MAX_PATH); + char *sfile = [file UTF8String]; + strcpy(changed_prefs.floppyslots[drive].df, sfile); + write_log ("Selected Disk Image: %s for Drive: %d\n", sfile, drive); // Save the path of this disk image so that future open panels can start in the same directory [[NSUserDefaults standardUserDefaults] setObject:[file stringByDeletingLastPathComponent] forKey:@"LastUsedDiskImagePath"]; @@ -1137,7 +1137,9 @@ static BOOL wasFullscreen = NO; // used by ensureNotFullscreen() and restoreFull NSArray *files = [sheet filenames]; NSString *file = [files objectAtIndex:0]; - lossyASCIICopy (changed_prefs.romfile, file, COCOA_GUI_MAX_PATH); + char *sfile = [file UTF8String]; + strcpy(changed_prefs.romfile, sfile); + write_log ("Selected Kickrom: %s\n", sfile); [[NSUserDefaults standardUserDefaults] setObject:[file stringByDeletingLastPathComponent] forKey:@"LastUsedKickPath"]; } @@ -1193,7 +1195,9 @@ static BOOL wasFullscreen = NO; // used by ensureNotFullscreen() and restoreFull NSArray *files = [sheet filenames]; NSString *file = [files objectAtIndex:0]; - lossyASCIICopy (changed_prefs.flashfile, file, COCOA_GUI_MAX_PATH); + char *sfile = [file UTF8String]; + strcpy(changed_prefs.flashfile, sfile); + write_log ("Selected Flash RAM: %s\n", sfile); [[NSUserDefaults standardUserDefaults] setObject:[file stringByDeletingLastPathComponent] forKey:@"LastUsedFlashPath"]; } @@ -1249,7 +1253,9 @@ static BOOL wasFullscreen = NO; // used by ensureNotFullscreen() and restoreFull NSArray *files = [sheet filenames]; NSString *file = [files objectAtIndex:0]; - lossyASCIICopy (changed_prefs.cartfile, file, COCOA_GUI_MAX_PATH); + char *sfile = [file UTF8String]; + strcpy(changed_prefs.cartfile, sfile); + write_log ("Selected Cartridge: %s\n", sfile); [[NSUserDefaults standardUserDefaults] setObject:[file stringByDeletingLastPathComponent] forKey:@"LastUsedCartPath"]; } @@ -1304,10 +1310,10 @@ static BOOL wasFullscreen = NO; // used by ensureNotFullscreen() and restoreFull NSArray *files = [sheet filenames]; NSString *file = [files objectAtIndex:0]; char *sfile = [file UTF8String]; + write_log ("Loading SaveState from: %s ...", sfile); [[NSUserDefaults standardUserDefaults] setObject:[file stringByDeletingLastPathComponent] forKey:@"LastUsedSaveStatePath"]; - write_log ("Loading SaveState from: %s ...", sfile); savestate_initsave (sfile, 0, 0, 0); savestate_state = STATE_DORESTORE; write_log ("done\n"); @@ -1340,10 +1346,10 @@ static BOOL wasFullscreen = NO; // used by ensureNotFullscreen() and restoreFull NSString *file = [sheet filename]; char *sfile = [file UTF8String]; + write_log ("Saving SaveState to: %s ...", sfile); [[NSUserDefaults standardUserDefaults] setObject:[file stringByDeletingLastPathComponent] forKey:@"LastUsedSaveStatePath"]; - write_log ("Saving SaveState to: %s ...", sfile); // savestate_initsave (sfile, 0, 0, 0); save_state (sfile, "puae"); write_log ("done\n"); @@ -1602,7 +1608,7 @@ static BOOL wasFullscreen = NO; // used by ensureNotFullscreen() and restoreFull changed_prefs.sound_filter = 2; changed_prefs.sound_filter_type = 1; break; - } + } config_changed = 1; } @@ -1676,30 +1682,6 @@ void restoreFullscreen (void) wasFullscreen = NO; } -/* Make a null-terminated copy of the source NSString into buffer using lossy - * ASCII conversion. (Apple deprecated the 'lossyCString' method in NSString) - */ -void lossyASCIICopy (char *buffer, NSString *source, size_t maxLength) -{ - if (source == nil) { - buffer[0] = '\0'; - return; - } - - NSData *data = [source dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; - - if (data == nil) { - buffer[0] = '\0'; - return; - } - - [data getBytes:buffer length:maxLength]; - - /* Ensure null termination */ - NSUInteger len = [data length]; - buffer[(len >= maxLength) ? (maxLength - 1) : len] = '\0'; -} - /* This function is called from od-macosx/main.m * WARNING: This gets called *before* real_main(...)! */ diff --git a/src/include/xwin.h b/src/include/xwin.h index d7ab16c..5fdd166 100644 --- a/src/include/xwin.h +++ b/src/include/xwin.h @@ -38,7 +38,7 @@ extern void setup_greydither (int bits, allocfunc_type allocfunc); extern void setup_greydither_maxcol (int maxcol, allocfunc_type allocfunc); extern void setup_dither (int bits, allocfunc_type allocfunc); extern void DitherLine (uae_u8 *l, uae_u16 *r4g4b4, int x, int y, uae_s16 len, int bits) ASM_SYM_FOR_FUNC("DitherLine"); -extern int getvsyncrate (int hz); +extern double getvsyncrate (double hz); struct vidbuf_description { @@ -68,6 +68,7 @@ struct vidbuf_description uae_u8 *realbufmem; uae_u8 *linemem; uae_u8 *emergmem; + bool bufmem_allocated; int rowbytes; /* Bytes per row in the memory pointed at by bufmem. */ int pixbytes; /* Bytes per pixel. */ int width;