git.y1.nz

SameBoy

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

commit fef175dcc664d1d3794c0725c35c9666d31a93a3
parent bed26daf7354f2c0d1c6240ca0d7925857431cf5
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Fri,  9 Jun 2023 14:44:57 +0300

Use #pragma once for include guards, use #import exclusively on Obj-C files

Diffstat:
MAppleCommon/GBViewBase.h4++--
MAppleCommon/GBViewMetal.h2+-
MCocoa/BigSurToolbar.h4----
MCocoa/GBButtons.h5-----
MCocoa/GBOpenGLView.m2+-
MCocoa/GBTerminalTextFieldCell.h2+-
MCocoa/GBVisualizerView.h2+-
MCocoa/GBVisualizerView.m2+-
MCocoa/KeyboardShortcutPrivateAPIs.h6------
MCore/apu.h6+-----
MCore/camera.h5+----
MCore/cheats.h4+---
MCore/debugger.h5+----
MCore/defs.h4+---
MCore/display.h6+-----
MCore/gb.h4+---
MCore/joypad.h4+---
MCore/mbc.h5+----
MCore/memory.h5+----
MCore/model.h6+-----
MCore/printer.h5++---
MCore/random.h5+----
MCore/rewind.h5++---
MCore/rumble.h5+----
MCore/save_state.h6++----
MCore/sgb.h6++----
MCore/sm83_cpu.h5+----
MCore/symbol_hash.h5++---
MCore/timing.h6++----
MCore/workboy.h6++----
MJoyKit/JOYController.m6+++---
MJoyKit/JOYElement.h2+-
MJoyKit/JOYElement.m4++--
MJoyKit/JOYFullReportElement.h4++--
MJoyKit/JOYFullReportElement.m2+-
MJoyKit/JOYMultiplayerController.h2+-
MJoyKit/JoyKit.h7++-----
MOpenDialog/open_dialog.h4+---
MQuickLook/get_image_for_rom.h8++------
MSDL/audio/audio.h5+----
MSDL/configuration.h5+----
MSDL/font.h6+-----
MSDL/gui.h5+----
MSDL/opengl_compat.h5+----
MSDL/shader.h6++----
MSDL/utils.h6++----
MiOS/GBROMManager.m2+-
MiOS/GBSettingsViewController.h2+-
MiOS/GBViewController.m2+-
MiOS/main.m2+-
50 files changed, 63 insertions(+), 159 deletions(-)

diff --git a/AppleCommon/GBViewBase.h b/AppleCommon/GBViewBase.h @@ -1,5 +1,5 @@ -#include <TargetConditionals.h> -#include <Core/gb.h> +#import <TargetConditionals.h> +#import <Core/gb.h> #if TARGET_OS_IPHONE #define NSView UIView diff --git a/AppleCommon/GBViewMetal.h b/AppleCommon/GBViewMetal.h @@ -1,4 +1,4 @@ -#include <TargetConditionals.h> +#import <TargetConditionals.h> #import <MetalKit/MetalKit.h> #if TARGET_OS_IPHONE #import "../iOS/GBView.h" diff --git a/Cocoa/BigSurToolbar.h b/Cocoa/BigSurToolbar.h @@ -1,6 +1,4 @@ #import <Cocoa/Cocoa.h> -#ifndef BigSurToolbar_h -#define BigSurToolbar_h /* Backport the toolbarStyle property to allow compilation with older SDKs*/ #ifndef __MAC_10_16 @@ -26,5 +24,3 @@ typedef NS_ENUM(NSInteger, NSWindowToolbarStyle) { @end #endif - -#endif diff --git a/Cocoa/GBButtons.h b/Cocoa/GBButtons.h @@ -1,6 +1,3 @@ -#ifndef GBButtons_h -#define GBButtons_h - typedef enum : NSUInteger { GBRight, GBLeft, @@ -37,5 +34,3 @@ static inline NSString *button_to_preference_name(GBButton button, unsigned play } return [NSString stringWithFormat:@"GB%@", GBButtonNames[button]]; } - -#endif diff --git a/Cocoa/GBOpenGLView.m b/Cocoa/GBOpenGLView.m @@ -1,6 +1,6 @@ #import "GBOpenGLView.h" #import "GBView.h" -#include <OpenGL/gl.h> +#import <OpenGL/gl.h> @implementation GBOpenGLView diff --git a/Cocoa/GBTerminalTextFieldCell.h b/Cocoa/GBTerminalTextFieldCell.h @@ -1,5 +1,5 @@ #import <Cocoa/Cocoa.h> -#include <Core/gb.h> +#import <Core/gb.h> @interface GBTerminalTextFieldCell : NSTextFieldCell @property (nonatomic) GB_gameboy_t *gb; diff --git a/Cocoa/GBVisualizerView.h b/Cocoa/GBVisualizerView.h @@ -1,5 +1,5 @@ #import <Cocoa/Cocoa.h> -#include <Core/gb.h> +#import <Core/gb.h> @interface GBVisualizerView : NSView - (void)addSample:(GB_sample_t *)sample; diff --git a/Cocoa/GBVisualizerView.m b/Cocoa/GBVisualizerView.m @@ -1,6 +1,6 @@ #import "GBVisualizerView.h" #import "GBPaletteEditorController.h" -#include <Core/gb.h> +#import <Core/gb.h> #define SAMPLE_COUNT 1024 diff --git a/Cocoa/KeyboardShortcutPrivateAPIs.h b/Cocoa/KeyboardShortcutPrivateAPIs.h @@ -1,6 +1,3 @@ -#ifndef KeyboardShortcutPrivateAPIs_h -#define KeyboardShortcutPrivateAPIs_h - /* These are private APIs, but they are a very simple and comprehensive way to convert a key equivalent to its display name. */ @@ -22,5 +19,3 @@ @interface NSPrefPaneUtils : NSObject + (id)stringForVirtualKey:(unsigned int)key modifiers:(unsigned int)flags; @end - -#endif - diff --git a/Core/apu.h b/Core/apu.h @@ -1,5 +1,4 @@ -#ifndef apu_h -#define apu_h +#pragma once #include <stdbool.h> #include <stdint.h> #include <stddef.h> @@ -197,6 +196,3 @@ internal void GB_apu_div_secondary_event(GB_gameboy_t *gb); internal void GB_apu_init(GB_gameboy_t *gb); internal void GB_apu_run(GB_gameboy_t *gb, bool force); #endif - -#endif - diff --git a/Core/camera.h b/Core/camera.h @@ -1,5 +1,4 @@ -#ifndef camera_h -#define camera_h +#pragma once #include <stdint.h> #include "defs.h" @@ -25,5 +24,3 @@ enum { GB_CAMERA_DITHERING_PATTERN_END = 0x35, }; #endif - -#endif diff --git a/Core/cheats.h b/Core/cheats.h @@ -1,5 +1,4 @@ -#ifndef cheats_h -#define cheats_h +#pragma once #ifndef GB_DISABLE_CHEATS #include "defs.h" @@ -40,4 +39,3 @@ struct GB_cheat_s { #define GB_apply_cheat(...) #endif // GB_INTERNAL #endif // GB_DISABLE_CHEATS -#endif diff --git a/Core/debugger.h b/Core/debugger.h @@ -1,5 +1,4 @@ -#ifndef debugger_h -#define debugger_h +#pragma once #ifndef GB_DISABLE_DEBUGGER #include <stdbool.h> #include <stdint.h> @@ -45,5 +44,3 @@ internal void GB_debugger_add_symbol(GB_gameboy_t *gb, uint16_t bank, uint16_t a #endif // GB_INTERNAL #endif // GB_DISABLE_DEBUGGER - -#endif diff --git a/Core/defs.h b/Core/defs.h @@ -1,5 +1,4 @@ -#ifndef defs_h -#define defs_h +#pragma once #define GB_likely(x) __builtin_expect((bool)(x), 1) #define GB_unlikely(x) __builtin_expect((bool)(x), 0) @@ -59,4 +58,3 @@ struct GB_gameboy_s; typedef struct GB_gameboy_s GB_gameboy_t; -#endif diff --git a/Core/display.h b/Core/display.h @@ -1,5 +1,4 @@ -#ifndef display_h -#define display_h +#pragma once #include "gb.h" #include <stdbool.h> @@ -78,6 +77,3 @@ void GB_set_object_rendering_disabled(GB_gameboy_t *gb, bool disabled); void GB_set_background_rendering_disabled(GB_gameboy_t *gb, bool disabled); bool GB_is_object_rendering_disabled(GB_gameboy_t *gb); bool GB_is_background_rendering_disabled(GB_gameboy_t *gb); - - -#endif diff --git a/Core/gb.h b/Core/gb.h @@ -1,5 +1,4 @@ -#ifndef GB_h -#define GB_h +#pragma once #include <stdbool.h> #include <stdint.h> #include <stdalign.h> @@ -1016,4 +1015,3 @@ internal void GB_clear_running_thread(GB_gameboy_t *gb); #endif #endif -#endif diff --git a/Core/joypad.h b/Core/joypad.h @@ -1,5 +1,4 @@ -#ifndef joypad_h -#define joypad_h +#pragma once #include "defs.h" #include <stdbool.h> @@ -43,4 +42,3 @@ void GB_set_emulate_joypad_bouncing(GB_gameboy_t *gb, bool emulate); internal void GB_update_joyp(GB_gameboy_t *gb); internal void GB_joypad_run(GB_gameboy_t *gb, unsigned cycles); #endif -#endif diff --git a/Core/mbc.h b/Core/mbc.h @@ -1,5 +1,4 @@ -#ifndef mbc_h -#define mbc_h +#pragma once #include "defs.h" #include <stdbool.h> @@ -29,5 +28,3 @@ internal void GB_update_mbc_mappings(GB_gameboy_t *gb); internal void GB_configure_cart(GB_gameboy_t *gb); internal void GB_reset_mbc(GB_gameboy_t *gb); #endif - -#endif diff --git a/Core/memory.h b/Core/memory.h @@ -1,5 +1,4 @@ -#ifndef memory_h -#define memory_h +#pragma once #include "defs.h" #include <stdint.h> @@ -18,5 +17,3 @@ internal void GB_hdma_run(GB_gameboy_t *gb); internal void GB_trigger_oam_bug(GB_gameboy_t *gb, uint16_t address); internal uint8_t GB_read_oam(GB_gameboy_t *gb, uint8_t addr); #endif - -#endif diff --git a/Core/model.h b/Core/model.h @@ -1,5 +1,4 @@ -#ifndef model_h -#define model_h +#pragma once #define GB_MODEL_FAMILY_MASK 0xF00 #define GB_MODEL_DMG_FAMILY 0x000 @@ -38,6 +37,3 @@ typedef enum { //GB_MODEL_AGB_E = 0x209 //GB_MODEL_GBP_E = GB_MODEL_AGB_E | GB_MODEL_GBP_BIT, // AGB-E inside a Game Boy Player } GB_model_t; - - -#endif diff --git a/Core/printer.h b/Core/printer.h @@ -1,5 +1,5 @@ -#ifndef printer_h -#define printer_h +#pragma once + #include <stdint.h> #include <stdbool.h> #include "defs.h" @@ -62,4 +62,3 @@ typedef struct void GB_connect_printer(GB_gameboy_t *gb, GB_print_image_callback_t callback, GB_printer_done_callback_t done_callback); -#endif diff --git a/Core/random.h b/Core/random.h @@ -1,5 +1,4 @@ -#ifndef random_h -#define random_h +#pragma once #include <stdint.h> #include <stdbool.h> @@ -8,5 +7,3 @@ uint8_t GB_random(void); uint32_t GB_random32(void); void GB_random_seed(uint64_t seed); void GB_random_set_enabled(bool enable); - -#endif diff --git a/Core/rewind.h b/Core/rewind.h @@ -1,5 +1,5 @@ -#ifndef rewind_h -#define rewind_h +#pragma once + #ifndef GB_DISABLE_REWIND #include <stdbool.h> #include "defs.h" @@ -12,4 +12,3 @@ void GB_set_rewind_length(GB_gameboy_t *gb, double seconds); void GB_rewind_reset(GB_gameboy_t *gb); #endif -#endif diff --git a/Core/rumble.h b/Core/rumble.h @@ -1,5 +1,4 @@ -#ifndef rumble_h -#define rumble_h +#pragma once #include "defs.h" @@ -13,5 +12,3 @@ typedef enum { internal void GB_handle_rumble(GB_gameboy_t *gb); #endif void GB_set_rumble_mode(GB_gameboy_t *gb, GB_rumble_mode_t mode); - -#endif diff --git a/Core/save_state.h b/Core/save_state.h @@ -1,6 +1,6 @@ +#pragma once + /* Macros to make the GB_gameboy_t struct more future compatible when state saving */ -#ifndef save_state_h -#define save_state_h #include <stddef.h> #define GB_PADDING(type, old_usage) type old_usage##__do_not_use @@ -54,5 +54,3 @@ static inline uint32_t GB_state_magic(void) internal size_t GB_get_save_state_size_no_bess(GB_gameboy_t *gb); internal void GB_save_state_to_buffer_no_bess(GB_gameboy_t *gb, uint8_t *buffer); #endif - -#endif diff --git a/Core/sgb.h b/Core/sgb.h @@ -1,5 +1,5 @@ -#ifndef sgb_h -#define sgb_h +#pragma once + #include "defs.h" #include <stdint.h> #include <stdbool.h> @@ -67,5 +67,3 @@ internal void GB_sgb_render(GB_gameboy_t *gb); internal void GB_sgb_load_default_data(GB_gameboy_t *gb); #endif - -#endif diff --git a/Core/sm83_cpu.h b/Core/sm83_cpu.h @@ -1,5 +1,4 @@ -#ifndef sm83_cpu_h -#define sm83_cpu_h +#pragma once #include "defs.h" #include <stdint.h> @@ -9,5 +8,3 @@ void GB_cpu_disassemble(GB_gameboy_t *gb, uint16_t pc, uint16_t count); #ifdef GB_INTERNAL internal void GB_cpu_run(GB_gameboy_t *gb); #endif - -#endif diff --git a/Core/symbol_hash.h b/Core/symbol_hash.h @@ -1,5 +1,5 @@ -#ifndef symbol_hash_h -#define symbol_hash_h +#pragma once + #ifndef GB_DISABLE_DEBUGGER #include <stdlib.h> #include <string.h> @@ -35,4 +35,3 @@ internal GB_symbol_map_t *GB_map_alloc(void); internal void GB_map_free(GB_symbol_map_t *map); #endif #endif -#endif diff --git a/Core/timing.h b/Core/timing.h @@ -1,5 +1,5 @@ -#ifndef timing_h -#define timing_h +#pragma once + #include "defs.h" typedef enum { @@ -57,5 +57,3 @@ GB_STATE_MACHINE(gb, unit, cycles, divisor) #endif #define GB_UNIT(unit) int32_t unit##_cycles, unit##_state - -#endif diff --git a/Core/workboy.h b/Core/workboy.h @@ -1,5 +1,5 @@ -#ifndef workboy_h -#define workboy_h +#pragma once + #include <stdint.h> #include <stdbool.h> #include <time.h> @@ -114,5 +114,3 @@ void GB_connect_workboy(GB_gameboy_t *gb, GB_workboy_get_time_callback get_time_callback); bool GB_workboy_is_enabled(GB_gameboy_t *gb); void GB_workboy_set_key(GB_gameboy_t *gb, uint8_t key); - -#endif diff --git a/JoyKit/JOYController.m b/JoyKit/JOYController.m @@ -5,9 +5,9 @@ #import "JOYFullReportElement.h" #import "JOYButton.h" #import "JOYEmulatedButton.h" -#include <IOKit/hid/IOHIDLib.h> +#import <IOKit/hid/IOHIDLib.h> -#include <AppKit/AppKit.h> +#import <AppKit/AppKit.h> extern NSTextField *globalDebugField; #define PWM_RESOLUTION 16 @@ -1199,7 +1199,7 @@ typedef union { + (void)load { -#include "ControllerConfiguration.inc" +#import "ControllerConfiguration.inc" } +(void)registerListener:(id<JOYListener>)listener diff --git a/JoyKit/JOYElement.h b/JoyKit/JOYElement.h @@ -1,5 +1,5 @@ #import <Foundation/Foundation.h> -#include <IOKit/hid/IOHIDLib.h> +#import <IOKit/hid/IOHIDLib.h> @interface JOYElement : NSObject<NSCopying> - (instancetype)initWithElement:(IOHIDElementRef)element; diff --git a/JoyKit/JOYElement.m b/JoyKit/JOYElement.m @@ -1,6 +1,6 @@ #import "JOYElement.h" -#include <IOKit/hid/IOHIDLib.h> -#include <objc/runtime.h> +#import <IOKit/hid/IOHIDLib.h> +#import <objc/runtime.h> @implementation JOYElement { diff --git a/JoyKit/JOYFullReportElement.h b/JoyKit/JOYFullReportElement.h @@ -1,6 +1,6 @@ #import <Foundation/Foundation.h> -#include <IOKit/hid/IOHIDLib.h> -#include "JOYElement.h" +#import <IOKit/hid/IOHIDLib.h> +#import "JOYElement.h" @interface JOYFullReportElement : JOYElement<NSCopying> - (instancetype)initWithDevice:(IOHIDDeviceRef) device reportID:(unsigned)reportID; diff --git a/JoyKit/JOYFullReportElement.m b/JoyKit/JOYFullReportElement.m @@ -1,5 +1,5 @@ #import "JOYFullReportElement.h" -#include <IOKit/hid/IOHIDLib.h> +#import <IOKit/hid/IOHIDLib.h> @implementation JOYFullReportElement { diff --git a/JoyKit/JOYMultiplayerController.h b/JoyKit/JOYMultiplayerController.h @@ -1,5 +1,5 @@ #import "JOYController.h" -#include <IOKit/hid/IOHIDLib.h> +#import <IOKit/hid/IOHIDLib.h> @interface JOYMultiplayerController : JOYController - (instancetype)initWithDevice:(IOHIDDeviceRef) device reportIDFilters:(NSArray <NSArray <NSNumber *> *>*) reportIDFilters hacks:hacks; diff --git a/JoyKit/JoyKit.h b/JoyKit/JoyKit.h @@ -1,6 +1,3 @@ -#ifndef JoyKit_h -#define JoyKit_h +#pragma once -#include "JOYController.h" - -#endif +#import "JOYController.h" diff --git a/OpenDialog/open_dialog.h b/OpenDialog/open_dialog.h @@ -1,7 +1,5 @@ -#ifndef open_rom_h -#define open_rom_h +#pragma once char *do_open_rom_dialog(void); char *do_open_folder_dialog(void); char *do_save_recording_dialog(unsigned frequency); -#endif diff --git a/QuickLook/get_image_for_rom.h b/QuickLook/get_image_for_rom.h @@ -1,10 +1,6 @@ -#ifndef get_image_for_rom_h -#define get_image_for_rom_h +#pragma once + #include <stdint.h> 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); - - -#endif diff --git a/SDL/audio/audio.h b/SDL/audio/audio.h @@ -1,5 +1,4 @@ -#ifndef sdl_audio_h -#define sdl_audio_h +#pragma once #include <stdbool.h> #include <stddef.h> @@ -41,5 +40,3 @@ typedef struct { } #define GB_AUDIO_DRIVER_REF(name) ({extern const GB_audio_driver_t name##driver; &name##driver;}) - -#endif diff --git a/SDL/configuration.h b/SDL/configuration.h @@ -1,5 +1,4 @@ -#ifndef configuration_h -#define configuration_h +#pragma once #include <SDL.h> #include <Core/gb.h> @@ -136,5 +135,3 @@ typedef struct { } configuration_t; extern configuration_t configuration; - -#endif diff --git a/SDL/font.h b/SDL/font.h @@ -1,5 +1,4 @@ -#ifndef font_h -#define font_h +#pragma once #include <stdint.h> extern uint8_t font[]; @@ -20,6 +19,3 @@ extern const uint8_t font_max; #define COPYRIGHT_STRING "\x90" #define CHECKBOX_OFF_STRING "\x93" #define CHECKBOX_ON_STRING "\x94" - -#endif - diff --git a/SDL/gui.h b/SDL/gui.h @@ -1,5 +1,4 @@ -#ifndef gui_h -#define gui_h +#pragma once #include <SDL.h> #include <Core/gb.h> @@ -66,5 +65,3 @@ extern unsigned osd_countdown; extern unsigned osd_text_lines; void convert_mouse_coordinates(signed *x, signed *y); const GB_palette_t *current_dmg_palette(void); - -#endif diff --git a/SDL/opengl_compat.h b/SDL/opengl_compat.h @@ -1,5 +1,4 @@ -#ifndef opengl_compat_h -#define opengl_compat_h +#pragma once #define GL_GLEXT_PROTOTYPES #include <SDL_opengl.h> @@ -41,5 +40,3 @@ if (!GL_COMPAT_NAME(func)) GL_COMPAT_NAME(func) = SDL_GL_GetProcAddress(#func); #define glGetShaderiv GL_COMPAT_WRAPPER(glGetShaderiv) #define glGetShaderInfoLog GL_COMPAT_WRAPPER(glGetShaderInfoLog) #endif - -#endif diff --git a/SDL/shader.h b/SDL/shader.h @@ -1,5 +1,5 @@ -#ifndef shader_h -#define shader_h +#pragma once + #include "opengl_compat.h" #include <stdbool.h> @@ -30,5 +30,3 @@ void render_bitmap_with_shader(shader_t *shader, void *bitmap, void *previous, unsigned x, unsigned y, unsigned w, unsigned h, GB_frame_blending_mode_t blending_mode); void free_shader(struct shader_s *shader); - -#endif diff --git a/SDL/utils.h b/SDL/utils.h @@ -1,8 +1,6 @@ -#ifndef utils_h -#define utils_h +#pragma once + #include <stddef.h> char *resource_path(const char *filename); void replace_extension(const char *src, size_t length, char *dest, const char *ext); - -#endif diff --git a/iOS/GBROMManager.m b/iOS/GBROMManager.m @@ -1,5 +1,5 @@ #import "GBROMManager.h" -#include <copyfile.h> +#import <copyfile.h> @implementation GBROMManager { diff --git a/iOS/GBSettingsViewController.h b/iOS/GBSettingsViewController.h @@ -1,5 +1,5 @@ #import <UIKit/UIKit.h> -#include <Core/gb.h> +#import <Core/gb.h> @interface GBSettingsViewController : UITableViewController + (UIViewController *)settingsViewControllerWithLeftButton:(UIBarButtonItem *)button; diff --git a/iOS/GBViewController.m b/iOS/GBViewController.m @@ -13,7 +13,7 @@ #import "GBSettingsViewController.h" #import "GBStatesViewController.h" #import <CoreMotion/CoreMotion.h> -#include <Core/gb.h> +#import <Core/gb.h> @implementation GBViewController { diff --git a/iOS/main.m b/iOS/main.m @@ -1,5 +1,5 @@ #import <UIKit/UIKit.h> -#include <Core/gb.h> +#import <Core/gb.h> #import "GBViewController.h" #import "GBView.h"

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