git.y1.nz

SameBoy

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

iOS/main.m

      1 #import <UIKit/UIKit.h>
      2 #import <Core/gb.h>
      3 #import "GBViewController.h"
      4 #import "GBView.h"
      5 #import "GBSettingsViewController.h"
      6 
      7 static double MigrateTurboSpeed(void)
      8 {
      9     unsigned old = [[NSUserDefaults standardUserDefaults] integerForKey:@"GBTurboSpeed"];
     10     if (old == 1) return 0;
     11     return old;
     12 }
     13 
     14 int main(int argc, char * argv[])
     15 {
     16     @autoreleasepool {
     17         NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
     18         [defaults registerDefaults:@{
     19             @"GBFilter": @"NearestNeighbor",
     20             @"GBColorCorrection": @(GB_COLOR_CORRECTION_MODERN_BALANCED),
     21             @"GBAudioMode": @"switch",
     22             @"GBHighpassFilter": @(GB_HIGHPASS_ACCURATE),
     23             @"GBRewindLength": @120,
     24             @"GBFrameBlendingMode": @(GB_FRAME_BLENDING_MODE_ACCURATE),
     25             
     26             @"GBDMGModel": @(GB_MODEL_DMG_B),
     27             @"GBCGBModel": @(GB_MODEL_CGB_E),
     28             @"GBAGBModel": @(GB_MODEL_AGB_A),
     29             @"GBSGBModel": @(GB_MODEL_SGB2),
     30             @"GBRumbleMode": @(GB_RUMBLE_CARTRIDGE_ONLY),
     31             @"GBButtonHaptics": @YES,
     32             @"GBHapticsStrength": @0.75,
     33             @"GBTurboCap": @(MigrateTurboSpeed()),
     34             @"GBRewindSpeed": @1,
     35             @"GBDynamicSpeed": @NO,
     36             @"GBFauxAnalogInputs": @NO,
     37             @"GBRumbleStrength": @1,
     38             
     39             @"GBInterfaceTheme": @"SameBoy",
     40             @"GBControllersHideInterface": @(GBControllerFocusOn),
     41                         
     42             @"GBCurrentTheme": @"Lime (Game Boy)",
     43             // Default themes
     44             @"GBThemes": @{
     45                     @"Canyon": @{
     46                             @"BrightnessBias": @0.1227009965823247,
     47                             @"Colors": @[@0xff0c1e20, @0xff122b91, @0xff466aa2, @0xfff1efae, @0xfff1efae],
     48                             @"DisabledLCDColor": @NO,
     49                             @"HueBias": @0.01782661816105247,
     50                             @"HueBiasStrength": @1,
     51                             @"Manual": @NO,
     52                     },
     53                     @"Desert": @{
     54                             @"BrightnessBias": @0.0,
     55                             @"Colors": @[@0xff302f3e, @0xff576674, @0xff839ba4, @0xffb1d0d2, @0xffb7d7d8],
     56                             @"DisabledLCDColor": @YES,
     57                             @"HueBias": @0.10087773904382469,
     58                             @"HueBiasStrength": @0.062142056772908363,
     59                             @"Manual": @NO,
     60                     },
     61                     @"Evening": @{
     62                             @"BrightnessBias": @-0.10168700106441975,
     63                             @"Colors": @[@0xff362601, @0xff695518, @0xff899853, @0xffa6e4ae, @0xffa9eebb],
     64                             @"DisabledLCDColor": @YES,
     65                             @"HueBias": @0.60027079191058874,
     66                             @"HueBiasStrength": @0.33816297305747867,
     67                             @"Manual": @NO,
     68                     },
     69                     @"Fog": @{
     70                             @"BrightnessBias": @0.0,
     71                             @"Colors": @[@0xff373c34, @0xff737256, @0xff9da386, @0xffc3d2bf, @0xffc7d8c6],
     72                             @"DisabledLCDColor": @YES,
     73                             @"HueBias": @0.55750435756972117,
     74                             @"HueBiasStrength": @0.18424738545816732,
     75                             @"Manual": @NO,
     76                     },
     77                     @"Green Slate": @{
     78                             @"BrightnessBias": @0.2210012227296829,
     79                             @"Colors": @[@0xff343117, @0xff6a876f, @0xff98b4a1, @0xffc3daca, @0xffc8decf],
     80                             @"DisabledLCDColor": @YES,
     81                             @"HueBias": @0.1887667975388467,
     82                             @"HueBiasStrength": @0.1272283345460892,
     83                             @"Manual": @NO,
     84                     },
     85                     @"Green Tea": @{
     86                             @"BrightnessBias": @-0.4946326622596153,
     87                             @"Colors": @[@0xff1a1d08, @0xff1d5231, @0xff3b9774, @0xff97e4c6, @0xffa9eed1],
     88                             @"DisabledLCDColor": @YES,
     89                             @"HueBias": @0.1912955007245464,
     90                             @"HueBiasStrength": @0.3621708039314516,
     91                             @"Manual": @NO,
     92                     },
     93                     @"Lavender": @{
     94                             @"BrightnessBias": @0.10072476038566,
     95                             @"Colors": @[@0xff2b2a3a, @0xff8c507c, @0xffbf82a8, @0xffe9bcce, @0xffeec3d3],
     96                             @"DisabledLCDColor": @YES,
     97                             @"HueBias": @0.7914529587142169,
     98                             @"HueBiasStrength": @0.2498168498277664,
     99                             @"Manual": @NO,
    100                     },
    101                     @"Magic Eggplant": @{
    102                             @"BrightnessBias": @0.0,
    103                             @"Colors": @[@0xff3c2136, @0xff942e84, @0xffc7699d, @0xfff1e4b0, @0xfff6f9b2],
    104                             @"DisabledLCDColor": @YES,
    105                             @"HueBias": @0.87717878486055778,
    106                             @"HueBiasStrength": @0.65018052788844627,
    107                             @"Manual": @NO,
    108                     },
    109                     @"Mystic Blue": @{
    110                             @"BrightnessBias": @-0.3291049897670746,
    111                             @"Colors": @[@0xff3b2306, @0xffa27807, @0xffd1b523, @0xfff6ebbe, @0xfffaf1e4],
    112                             @"DisabledLCDColor": @YES,
    113                             @"HueBias": @0.5282051088288426,
    114                             @"HueBiasStrength": @0.7699633836746216,
    115                             @"Manual": @NO,
    116                     },
    117                     @"Pink Pop": @{
    118                             @"BrightnessBias": @0.624908447265625,
    119                             @"Colors": @[@0xff28140a, @0xff7c42cb, @0xffaa83de, @0xffd1ceeb, @0xffd5d8ec],
    120                             @"DisabledLCDColor": @YES,
    121                             @"HueBias": @0.9477411056868732,
    122                             @"HueBiasStrength": @0.80024421215057373,
    123                             @"Manual": @NO,
    124                     },
    125                     @"Radioactive Pea": @{
    126                             @"BrightnessBias": @-0.48079556772908372,
    127                             @"Colors": @[@0xff215200, @0xff1f7306, @0xff169e34, @0xff03ceb8, @0xff00d4d1],
    128                             @"DisabledLCDColor": @YES,
    129                             @"HueBias": @0.3795131972111554,
    130                             @"HueBiasStrength": @0.34337649402390436,
    131                             @"Manual": @NO,
    132                     },
    133                     @"Rose": @{
    134                             @"BrightnessBias": @0.2727272808551788,
    135                             @"Colors": @[@0xff001500, @0xff4e1fae, @0xff865ac4, @0xffb7e6d3, @0xffbdffd4],
    136                             @"DisabledLCDColor": @YES,
    137                             @"HueBias": @0.9238900924101472,
    138                             @"HueBiasStrength": @0.9957716464996338,
    139                             @"Manual": @NO,
    140                     },
    141                     @"Seaweed": @{
    142                             @"BrightnessBias": @-0.28532744023904377,
    143                             @"Colors": @[@0xff3f0015, @0xff426532, @0xff58a778, @0xff95e0df, @0xffa0e7ee],
    144                             @"DisabledLCDColor": @YES,
    145                             @"HueBias": @0.2694067480079681,
    146                             @"HueBiasStrength": @0.51565612549800799,
    147                             @"Manual": @NO,
    148                     },
    149                     @"Twilight": @{
    150                             @"BrightnessBias": @-0.091789093625498031,
    151                             @"Colors": @[@0xff3f0015, @0xff461286, @0xff6254bd, @0xff97d3e9, @0xffa0e7ee],
    152                             @"DisabledLCDColor": @YES,
    153                             @"HueBias": @0.0,
    154                             @"HueBiasStrength": @0.49710532868525897,
    155                             @"Manual": @NO,
    156                     },
    157             },
    158             
    159             // Forces iOS to use Solarium even when linking against older SDKs
    160             @"com.apple.SwiftUI.IgnoreSolariumLinkedOnCheck": @YES,
    161         }];
    162         
    163         if (![[defaults stringForKey:@"GBThemesVersion"] isEqualToString:@(GB_VERSION)]) {
    164             NSMutableDictionary *currentThemes = [defaults dictionaryForKey:@"GBThemes"].mutableCopy;
    165             [defaults removeObjectForKey:@"GBThemes"];
    166             NSMutableDictionary *defaultThemes = [defaults dictionaryForKey:@"GBThemes"].mutableCopy;
    167             if (![[NSUserDefaults standardUserDefaults] stringForKey:@"GBThemesVersion"]) {
    168                 // Force update the Pink Pop theme, it was glitchy in 1.0
    169                 [currentThemes removeObjectForKey:@"Pink Pop"];
    170             }
    171             [defaultThemes addEntriesFromDictionary:currentThemes];
    172             [defaults setObject:defaultThemes forKey:@"GBThemes"];
    173             [[NSUserDefaults standardUserDefaults] setObject:@(GB_VERSION) forKey:@"GBThemesVersion"];
    174         }
    175     }
    176     return UIApplicationMain(argc, argv, nil, NSStringFromClass([GBViewController class]));
    177 }

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