git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 698c75f59fbc6ffffbde3ea6da6fd41018f47a37
parent dcda71820811aef52a9c4570af4421e11bce3b43
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Fri, 27 Feb 2026 02:46:18 +0200

Move OpenDialog to the SDL folder

Diffstat:
MCONTRIBUTING.md2+-
MMakefile10+++++-----
DOpenDialog/cocoa.m66------------------------------------------------------------------
MSDL/gui.c2+-
MSDL/main.c4++--
ASDL/open_dialog/cocoa.m65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ROpenDialog/gtk.c -> SDL/open_dialog/gtk.c0
ROpenDialog/open_dialog.h -> SDL/open_dialog/open_dialog.h0
ROpenDialog/windows.c -> SDL/open_dialog/windows.c0
9 files changed, 74 insertions(+), 75 deletions(-)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md @@ -18,7 +18,7 @@ To allow quicker integration into SameBoy's master branch, contributors are aske ### Languages and Compilers -SameBoy's core, SDL frontend, Libretro frontend, and automatic tester (Folders `Core`, `SDL` & `OpenDialog`, `libretro`, and `Tester`; respectively) are all written in C11. The Cocoa frontend, SameBoy's fork of Hex Fiend, JoyKit and the Quick Look previewer (Folders `Cocoa`, `HexFiend`, `JoyKit` and `QuickLook`; respectively) are all written in ARC-enabled Objective-C. The SameBoot ROMs (Under `BootROMs`) are written in rgbds-flavor SM83 assembly, with build tools in C11. The shaders (inside `Shaders`) are written in a polyglot GLSL and Metal style, with a few GLSL- and Metal-specific sources. The build system uses standalone Make, in the GNU flavor. Avoid adding new languages (C++, Swift, Python, CMake...) to any of the existing sub-projects. +SameBoy's core, SDL frontend, Libretro frontend, and automatic tester (Folders `Core`, `SDL`, `libretro`, and `Tester`; respectively) are all written in C11. The Cocoa frontend, SameBoy's fork of Hex Fiend, JoyKit and the Quick Look previewer (Folders `Cocoa`, `HexFiend`, `JoyKit` and `QuickLook`; respectively) are all written in ARC-enabled Objective-C. The SameBoot ROMs (Under `BootROMs`) are written in rgbds-flavor SM83 assembly, with build tools in C11. The shaders (inside `Shaders`) are written in a polyglot GLSL and Metal style, with a few GLSL- and Metal-specific sources. The build system uses standalone Make, in the GNU flavor. Avoid adding new languages (C++, Swift, Python, CMake...) to any of the existing sub-projects. SameBoy's main target compiler is Clang, but GCC is also supported when targeting Linux and Libretro. Other compilers (e.g. MSVC) are not supported, and unless there's a good reason, there's no need to go out of your way to add specific support for them. Extensions that are supported by both compilers (Such as `typeof`) may be used if it makes sense. It's OK if you can't test one of these compilers yourself; once you push a commit, the CI bot will let you know if you broke something. diff --git a/Makefile b/Makefile @@ -179,14 +179,14 @@ RGBGFX_FLAGS := $(if $(filter $(shell echo 'println __RGBDS_MAJOR__ || (!__RGBDS # Set compilation and linkage flags based on target, platform and configuration -OPEN_DIALOG = OpenDialog/gtk.c +OPEN_DIALOG = SDL/open_dialog/gtk.c ifeq ($(PLATFORM),windows32) -OPEN_DIALOG = OpenDialog/windows.c +OPEN_DIALOG = SDL/open_dialog/windows.c endif ifeq ($(PLATFORM),Darwin) -OPEN_DIALOG = OpenDialog/cocoa.m +OPEN_DIALOG = SDL/open_dialog/cocoa.m endif # These must come before the -Wno- flags @@ -462,7 +462,7 @@ $(OBJ)/SDL/%.dep: SDL/% -@$(MKDIR) -p $(dir $@) $(CC) $(CFLAGS) $(SDL_CFLAGS) $(GL_CFLAGS) -MT $(OBJ)/$^.o -M $^ -o $@ -$(OBJ)/OpenDialog/%.dep: OpenDialog/% +$(OBJ)/SDL/open_dialog/%.dep: SDL/open_dialog/% -@$(MKDIR) -p $(dir $@) $(CC) $(CFLAGS) $(SDL_CFLAGS) $(GL_CFLAGS) -MT $(OBJ)/$^.o -M $^ -o $@ @@ -496,7 +496,7 @@ $(OBJ)/XdgThumbnailer/resources.c $(OBJ)/XdgThumbnailer/resources.h: %: XdgThumb CC=$(CC) glib-compile-resources --dependency-file $@.mk --generate-phony-targets --generate --target $@ $< -include $(OBJ)/XdgThumbnailer/resources.c.mk $(OBJ)/XdgThumbnailer/resources.h.mk -$(OBJ)/OpenDialog/%.c.o: OpenDialog/%.c +$(OBJ)/SDL/open_dialog/%.c.o: SDL/open_dialog/%.c -@$(MKDIR) -p $(dir $@) $(CC) $(CFLAGS) $(SDL_CFLAGS) $(GL_CFLAGS) -c $< -o $@ diff --git a/OpenDialog/cocoa.m b/OpenDialog/cocoa.m @@ -1,66 +0,0 @@ -#import <AppKit/AppKit.h> -#include "open_dialog.h" - - -char *do_open_rom_dialog(void) -{ - @autoreleasepool { - int stderr_fd = dup(STDERR_FILENO); - close(STDERR_FILENO); - NSWindow *key = [NSApp keyWindow]; - NSOpenPanel *dialog = [NSOpenPanel openPanel]; - dialog.title = @"Open ROM"; - dialog.allowedFileTypes = @[@"gb", @"gbc", @"sgb", @"isx"]; - if ([dialog runModal] != NSModalResponseOK) return nil; - [key makeKeyAndOrderFront:nil]; - NSString *ret = [[[dialog URLs] firstObject] path]; - dup2(stderr_fd, STDERR_FILENO); - if (ret) { - return strdup(ret.UTF8String); - } - return NULL; - } -} - -char *do_open_folder_dialog(void) -{ - @autoreleasepool { - int stderr_fd = dup(STDERR_FILENO); - close(STDERR_FILENO); - NSWindow *key = [NSApp keyWindow]; - NSOpenPanel *dialog = [NSOpenPanel openPanel]; - dialog.title = @"Select Boot ROMs Folder"; - dialog.canChooseDirectories = true; - dialog.canChooseFiles = false; - if ([dialog runModal] != NSModalResponseOK) return nil; - [key makeKeyAndOrderFront:nil]; - NSString *ret = [[[dialog URLs] firstObject] path]; - dup2(stderr_fd, STDERR_FILENO); - if (ret) { - return strdup(ret.UTF8String); - } - return NULL; - } -} - -/* The Cocoa variant of this function isn't as fully featured as the GTK and Windows ones, as Mac users would use - the fully featured Cocoa port of SameBoy anyway*/ -char *do_save_recording_dialog(unsigned frequency) -{ - @autoreleasepool { - int stderr_fd = dup(STDERR_FILENO); - close(STDERR_FILENO); - NSWindow *key = [NSApp keyWindow]; - NSSavePanel *dialog = [NSSavePanel savePanel]; - dialog.title = @"Audio recording save location"; - dialog.allowedFileTypes = @[@"aiff", @"aif", @"aifc", @"wav", @"raw", @"pcm"]; - if ([dialog runModal] != NSModalResponseOK) return nil; - [key makeKeyAndOrderFront:nil]; - NSString *ret = [[dialog URL] path]; - dup2(stderr_fd, STDERR_FILENO); - if (ret) { - return strdup(ret.UTF8String); - } - return NULL; - } -} diff --git a/SDL/gui.c b/SDL/gui.c @@ -1,4 +1,3 @@ -#include <OpenDialog/open_dialog.h> #include <SDL.h> #include <stdbool.h> #include <stdio.h> @@ -7,6 +6,7 @@ #include <string.h> #include <dirent.h> #include <ctype.h> +#include "open_dialog/open_dialog.h" #include "utils.h" #include "gui.h" #include "font.h" diff --git a/SDL/main.c b/SDL/main.c @@ -5,15 +5,15 @@ #include <unistd.h> #include <errno.h> #include <limits.h> -#include <OpenDialog/open_dialog.h> +#include <fcntl.h> #include <SDL.h> #include <Core/gb.h> +#include "open_dialog/open_dialog.h" #include "utils.h" #include "gui.h" #include "shader.h" #include "audio/audio.h" #include "console.h" -#include <fcntl.h> #ifdef _WIN32 #include <Windows.h> diff --git a/SDL/open_dialog/cocoa.m b/SDL/open_dialog/cocoa.m @@ -0,0 +1,65 @@ +#import <AppKit/AppKit.h> +#include "open_dialog.h" + +char *do_open_rom_dialog(void) +{ + @autoreleasepool { + int stderr_fd = dup(STDERR_FILENO); + close(STDERR_FILENO); + NSWindow *key = [NSApp keyWindow]; + NSOpenPanel *dialog = [NSOpenPanel openPanel]; + dialog.title = @"Open ROM"; + dialog.allowedFileTypes = @[@"gb", @"gbc", @"sgb", @"isx"]; + if ([dialog runModal] != NSModalResponseOK) return nil; + [key makeKeyAndOrderFront:nil]; + NSString *ret = [[[dialog URLs] firstObject] path]; + dup2(stderr_fd, STDERR_FILENO); + if (ret) { + return strdup(ret.UTF8String); + } + return NULL; + } +} + +char *do_open_folder_dialog(void) +{ + @autoreleasepool { + int stderr_fd = dup(STDERR_FILENO); + close(STDERR_FILENO); + NSWindow *key = [NSApp keyWindow]; + NSOpenPanel *dialog = [NSOpenPanel openPanel]; + dialog.title = @"Select Boot ROMs Folder"; + dialog.canChooseDirectories = true; + dialog.canChooseFiles = false; + if ([dialog runModal] != NSModalResponseOK) return nil; + [key makeKeyAndOrderFront:nil]; + NSString *ret = [[[dialog URLs] firstObject] path]; + dup2(stderr_fd, STDERR_FILENO); + if (ret) { + return strdup(ret.UTF8String); + } + return NULL; + } +} + +/* The Cocoa variant of this function isn't as fully featured as the GTK and Windows ones, as Mac users would use + the fully featured Cocoa port of SameBoy anyway*/ +char *do_save_recording_dialog(unsigned frequency) +{ + @autoreleasepool { + int stderr_fd = dup(STDERR_FILENO); + close(STDERR_FILENO); + NSWindow *key = [NSApp keyWindow]; + NSSavePanel *dialog = [NSSavePanel savePanel]; + dialog.title = @"Audio recording save location"; + dialog.allowedFileTypes = @[@"aiff", @"aif", @"aifc", @"wav", @"raw", @"pcm"]; + if ([dialog runModal] != NSModalResponseOK) return nil; + [key makeKeyAndOrderFront:nil]; + NSString *ret = [[dialog URL] path]; + dup2(stderr_fd, STDERR_FILENO); + if (ret) { + return strdup(ret.UTF8String); + } + return NULL; + } +} diff --git a/OpenDialog/gtk.c b/SDL/open_dialog/gtk.c diff --git a/OpenDialog/open_dialog.h b/SDL/open_dialog/open_dialog.h diff --git a/OpenDialog/windows.c b/SDL/open_dialog/windows.c

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.