Rebrand the thing
BIN
Cocoa/CPU.png
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 3.7 KiB |
BIN
Cocoa/CPU@2x.png
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 7.8 KiB |
|
@ -1999,24 +1999,4 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency)
|
|||
{
|
||||
return &gb;
|
||||
}
|
||||
|
||||
|
||||
static NSArray <NSString *> *_openableTypes()
|
||||
{
|
||||
return @[@"bin"];
|
||||
}
|
||||
|
||||
static Class documentClassForType()
|
||||
{
|
||||
return [Document class];
|
||||
}
|
||||
|
||||
+ (void)load
|
||||
{
|
||||
method_setImplementation(class_getInstanceMethod([NSDocumentController class],
|
||||
@selector(documentClassForType:)), (IMP)documentClassForType);
|
||||
method_setImplementation(class_getInstanceMethod([NSDocumentController class],
|
||||
@selector(_openableTypes)), (IMP)_openableTypes);
|
||||
|
||||
}
|
||||
@end
|
||||
|
|
|
@ -19,10 +19,6 @@
|
|||
<string>Mega Duck Game</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>com.github.liji32.sameduck.bin</string>
|
||||
</array>
|
||||
<key>LSTypeIsPackage</key>
|
||||
<integer>0</integer>
|
||||
<key>NSDocumentClass</key>
|
||||
|
@ -57,28 +53,6 @@
|
|||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>UTExportedTypeDeclarations</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Mega Duck Game</string>
|
||||
<key>UTTypeIconFile</key>
|
||||
<string>Cartridge</string>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>com.github.liji32.sameduck.bin</string>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>bin</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||
<true/>
|
||||
</dict>
|
||||
|
|
BIN
Cocoa/Joypad.png
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 1.1 MiB |
|
@ -11,7 +11,7 @@
|
|||
<string>QLGenerator</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>com.github.liji32.sameduck.bin</string>
|
||||
<string>com.apple.macbinary-archive</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
|
|
Before Width: | Height: | Size: 114 KiB |
|
@ -6,25 +6,19 @@ static OSStatus render(CGContextRef cgContext, CFURLRef url, bool showBorder)
|
|||
{
|
||||
/* Load the template NSImages when generating the first thumbnail */
|
||||
static NSImage *template = nil;
|
||||
static NSImage *templateUniversal = nil;
|
||||
static NSImage *templateColor = nil;
|
||||
static NSBundle *bundle = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
if (showBorder) {
|
||||
dispatch_once(&onceToken, ^{
|
||||
bundle = [NSBundle bundleWithIdentifier:@"com.github.liji32.sameduck.previewer"];
|
||||
template = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CartridgeTemplate" ofType:@"png"]];
|
||||
templateUniversal = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"UniversalCartridgeTemplate" ofType:@"png"]];
|
||||
templateColor = [[NSImage alloc] initWithContentsOfFile:[bundle pathForResource:@"ColorCartridgeTemplate" ofType:@"png"]];
|
||||
});
|
||||
}
|
||||
uint32_t bitmap[160*144];
|
||||
uint8_t cgbFlag = 0;
|
||||
|
||||
/* The cgb_boot_fast boot ROM skips the boot animation */
|
||||
if (get_image_for_rom([[(__bridge NSURL *)url path] UTF8String],
|
||||
[[bundle pathForResource:@"cgb_boot_fast" ofType:@"bin"] UTF8String],
|
||||
bitmap, &cgbFlag)) {
|
||||
bitmap)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -54,32 +48,15 @@ static OSStatus render(CGContextRef cgContext, CFURLRef url, bool showBorder)
|
|||
NSImage *screenshot = [[NSImage alloc] initWithCGImage:iref size:NSMakeSize(160, 144)];
|
||||
/* Draw the screenshot */
|
||||
if (showBorder) {
|
||||
[screenshot drawInRect:NSMakeRect(192, 150, 640, 576)];
|
||||
[screenshot drawInRect:NSMakeRect(192, 280, 640, 576)];
|
||||
}
|
||||
else {
|
||||
[screenshot drawInRect:NSMakeRect(0, 0, 640, 576)];
|
||||
}
|
||||
|
||||
if (showBorder) {
|
||||
/* Use the CGB flag to determine the cartridge "look":
|
||||
- DMG cartridges are grey
|
||||
- CGB cartridges are transparent
|
||||
- CGB cartridges that support DMG systems are black
|
||||
*/
|
||||
NSImage *effectiveTemplate = nil;
|
||||
switch (cgbFlag) {
|
||||
case 0xC0:
|
||||
effectiveTemplate = templateColor;
|
||||
break;
|
||||
case 0x80:
|
||||
effectiveTemplate = templateUniversal;
|
||||
break;
|
||||
default:
|
||||
effectiveTemplate = template;
|
||||
}
|
||||
|
||||
/* Mask it with the template (The middle part of the template image is transparent) */
|
||||
[effectiveTemplate drawInRect:(NSRect){{0, 0}, template.size}];
|
||||
[template drawInRect:(NSRect){{0, 0}, template.size}];
|
||||
}
|
||||
|
||||
CGColorSpaceRelease(colorSpaceRef);
|
||||
|
|
|
@ -45,15 +45,13 @@ static uint32_t rgb_encode(GB_gameboy_t *gb, uint8_t r, uint8_t g, uint8_t b)
|
|||
return (b << 16) | (g << 8) | (r) | 0xFF000000;
|
||||
}
|
||||
|
||||
int get_image_for_rom(const char *filename, const char *boot_path, uint32_t *output, uint8_t *cgb_flag)
|
||||
int get_image_for_rom(const char *filename, uint32_t *output)
|
||||
{
|
||||
GB_gameboy_t gb;
|
||||
GB_init(&gb, GB_MODEL_CGB_E);
|
||||
if (GB_load_boot_rom(&gb, boot_path)) {
|
||||
GB_free(&gb);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static const GB_palette_t palette = {{{26, 42, 39}, {57, 83, 75}, {99, 137, 128}, {152, 190, 180}, {152, 190, 180}}};
|
||||
GB_set_palette(&gb, &palette);
|
||||
GB_set_vblank_callback(&gb, (GB_vblank_callback_t) vblank);
|
||||
GB_set_pixels_output(&gb, output);
|
||||
GB_set_rgb_encode_callback(&gb, rgb_encode);
|
||||
|
@ -89,9 +87,6 @@ int get_image_for_rom(const char *filename, const char *boot_path, uint32_t *out
|
|||
GB_set_rendering_disabled(&gb, true);
|
||||
GB_set_turbo_mode(&gb, true, true);
|
||||
|
||||
*cgb_flag = GB_read_memory(&gb, 0x143) & 0xC0;
|
||||
|
||||
|
||||
while (local_data.running) {
|
||||
GB_run(&gb);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
typedef bool (*cancel_callback_t)(void*);
|
||||
|
||||
int get_image_for_rom(const char *filename, const char *boot_path, uint32_t *output, uint8_t *cgb_flag);
|
||||
|
||||
int get_image_for_rom(const char *filename, uint32_t *output);
|
||||
|
||||
#endif
|
||||
|
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
@ -9,7 +9,7 @@
|
|||
#include "gui.h"
|
||||
#include "font.h"
|
||||
|
||||
static const SDL_Color gui_palette[4] = {{8, 24, 16,}, {57, 97, 57,}, {132, 165, 99}, {198, 222, 140}};
|
||||
static const SDL_Color gui_palette[4] = {{26, 42, 39}, {57, 83, 75}, {99, 137, 128}, {152, 190, 180}};
|
||||
static uint32_t gui_palette_native[4];
|
||||
|
||||
SDL_Window *window = NULL;
|
||||
|
|
Before Width: | Height: | Size: 113 KiB |