2018-11-15 23:31:39 +00:00
|
|
|
/*****************************************************************************\
|
|
|
|
Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
|
|
|
|
This file is licensed under the Snes9x License.
|
|
|
|
For further information, consult the LICENSE file in the root directory.
|
|
|
|
\*****************************************************************************/
|
2010-09-25 15:46:12 +00:00
|
|
|
|
|
|
|
/***********************************************************************************
|
|
|
|
SNES9X for Mac OS (c) Copyright John Stiles
|
|
|
|
|
|
|
|
Snes9x for Mac OS X
|
|
|
|
|
2011-04-10 13:44:28 +00:00
|
|
|
(c) Copyright 2001 - 2011 zones
|
2010-09-25 15:46:12 +00:00
|
|
|
(c) Copyright 2002 - 2005 107
|
|
|
|
(c) Copyright 2002 PB1400c
|
|
|
|
(c) Copyright 2004 Alexander and Sander
|
|
|
|
(c) Copyright 2004 - 2005 Steven Seeger
|
|
|
|
(c) Copyright 2005 Ryan Vogt
|
2019-09-02 17:20:32 +00:00
|
|
|
(c) Copyright 2019 Michael Donald Buckley
|
2010-09-25 15:46:12 +00:00
|
|
|
***********************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _mac_os_h_
|
|
|
|
#define _mac_os_h_
|
|
|
|
|
2019-09-02 23:08:41 +00:00
|
|
|
#import <Cocoa/Cocoa.h>
|
2019-12-21 15:09:04 +00:00
|
|
|
#import <MetalKit/MetalKit.h>
|
2019-09-02 17:20:32 +00:00
|
|
|
|
2019-09-02 23:08:41 +00:00
|
|
|
#import <os/lock.h>
|
2019-09-02 17:20:32 +00:00
|
|
|
|
2019-10-05 20:16:19 +00:00
|
|
|
#import "mac-controls.h"
|
|
|
|
|
2010-09-25 15:46:12 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
SNES_MULTIPLAYER5,
|
|
|
|
SNES_MULTIPLAYER5_2,
|
|
|
|
SNES_JOYPAD,
|
|
|
|
SNES_MOUSE_SWAPPED,
|
|
|
|
SNES_MOUSE,
|
|
|
|
SNES_SUPERSCOPE,
|
|
|
|
SNES_JUSTIFIER,
|
|
|
|
SNES_JUSTIFIER_2,
|
|
|
|
SNES_MAX_CONTROLLER_OPTIONS
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
VIDEOMODE_BLOCKY,
|
|
|
|
VIDEOMODE_TV,
|
|
|
|
VIDEOMODE_SMOOTH,
|
2011-02-24 12:22:19 +00:00
|
|
|
VIDEOMODE_BLEND,
|
2010-09-25 15:46:12 +00:00
|
|
|
VIDEOMODE_SUPEREAGLE,
|
|
|
|
VIDEOMODE_2XSAI,
|
|
|
|
VIDEOMODE_SUPER2XSAI,
|
|
|
|
VIDEOMODE_EPX,
|
|
|
|
VIDEOMODE_HQ2X,
|
|
|
|
VIDEOMODE_HQ3X,
|
|
|
|
VIDEOMODE_HQ4X,
|
|
|
|
VIDEOMODE_NTSC_C,
|
|
|
|
VIDEOMODE_NTSC_S,
|
|
|
|
VIDEOMODE_NTSC_R,
|
|
|
|
VIDEOMODE_NTSC_M,
|
|
|
|
VIDEOMODE_NTSC_TV_C,
|
|
|
|
VIDEOMODE_NTSC_TV_S,
|
|
|
|
VIDEOMODE_NTSC_TV_R,
|
|
|
|
VIDEOMODE_NTSC_TV_M
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
long long nextTime[12];
|
|
|
|
uint16 buttonMask;
|
|
|
|
uint16 toggleMask;
|
|
|
|
uint16 tcMask;
|
|
|
|
uint16 invertMask;
|
|
|
|
SInt32 frequency;
|
|
|
|
} AutoFireState;
|
|
|
|
|
2019-09-07 15:38:12 +00:00
|
|
|
#define kMacWindowHeight (SNES_HEIGHT_EXTENDED)
|
2018-06-28 12:08:09 +00:00
|
|
|
#define MAC_MAX_CHEATS 150
|
2010-09-25 15:46:12 +00:00
|
|
|
|
|
|
|
extern volatile bool8 running, s9xthreadrunning;
|
|
|
|
extern volatile bool8 eventQueued, windowExtend;
|
|
|
|
extern uint32 controlPad[MAC_MAX_PLAYERS];
|
|
|
|
extern uint8 romDetect, interleaveDetect, videoDetect, headerDetect;
|
|
|
|
extern WindowRef gWindow;
|
2019-09-02 17:20:32 +00:00
|
|
|
extern uint32 glScreenW, glScreenH;
|
2010-09-25 15:46:12 +00:00
|
|
|
extern CGRect glScreenBounds;
|
|
|
|
extern CGImageRef macIconImage[118];
|
|
|
|
extern int macPadIconIndex, macLegendIconIndex, macMusicBoxIconIndex, macFunctionIconIndex;
|
|
|
|
extern int macFrameSkip;
|
|
|
|
extern int32 skipFrames;
|
|
|
|
extern int64 lastFrame;
|
|
|
|
extern unsigned long spcFileCount, pngFileCount;
|
2019-12-21 15:09:04 +00:00
|
|
|
extern bool8 finished, cartOpen, autofire;
|
|
|
|
extern bool8 fullscreen, autoRes, glstretch, gl32bit, vsync, drawoverscan, lastoverscan;
|
2010-09-25 15:46:12 +00:00
|
|
|
extern long drawingMethod;
|
|
|
|
extern int videoMode;
|
|
|
|
extern SInt32 macSoundVolume;
|
|
|
|
extern uint32 macSoundBuffer_ms, macSoundInterval_ms;
|
|
|
|
extern bool8 macSoundLagEnable;
|
|
|
|
extern uint16 aueffect;
|
|
|
|
extern uint8 saveInROMFolder;
|
2019-07-14 03:42:21 +00:00
|
|
|
extern NSString *saveFolderPath;
|
2010-09-25 15:46:12 +00:00
|
|
|
extern int macCurvatureWarp, macAspectRatio;
|
|
|
|
extern int macFastForwardRate, macFrameAdvanceRate;
|
|
|
|
extern int inactiveMode;
|
|
|
|
extern bool8 macQTRecord;
|
|
|
|
extern uint16 macRecordFlag, macPlayFlag, macQTMovFlag;
|
|
|
|
extern bool8 startopendlog, showtimeinfrz, enabletoggle, savewindowpos, onscreeninfo;
|
|
|
|
extern int musicboxmode;
|
|
|
|
extern bool8 applycheat;
|
|
|
|
extern int padSetting, deviceSetting, deviceSettingMaster;
|
|
|
|
extern int macControllerOption;
|
|
|
|
extern CGPoint unlimitedCursor;
|
|
|
|
extern char npServerIP[256], npName[256];
|
|
|
|
extern AutoFireState autofireRec[MAC_MAX_PLAYERS];
|
|
|
|
extern CFStringRef multiCartPath[2];
|
|
|
|
|
|
|
|
#ifdef MAC_PANTHER_SUPPORT
|
|
|
|
extern IconRef macIconRef[118];
|
|
|
|
#endif
|
|
|
|
|
2019-10-19 14:08:27 +00:00
|
|
|
extern bool8 pressedKeys[MAC_MAX_PLAYERS][kNumButtons];
|
|
|
|
extern bool8 pressedGamepadButtons[MAC_MAX_PLAYERS][kNumButtons];
|
2019-12-04 03:55:26 +00:00
|
|
|
extern pthread_mutex_t keyLock;
|
2019-09-02 17:20:32 +00:00
|
|
|
|
2020-03-19 00:54:18 +00:00
|
|
|
@interface S9xView: MTKView
|
|
|
|
- (void)updatePauseOverlay;
|
|
|
|
@end
|
|
|
|
extern S9xView *s9xView;
|
2019-09-02 17:20:32 +00:00
|
|
|
|
2010-09-25 15:46:12 +00:00
|
|
|
void AdjustMenus (void);
|
|
|
|
void UpdateMenuCommandStatus (Boolean);
|
|
|
|
void ApplyNSRTHeaderControllers (void);
|
2019-07-14 03:42:21 +00:00
|
|
|
void QuitWithFatalError (NSString *);
|
2010-09-25 15:46:12 +00:00
|
|
|
void ChangeInputDevice (void);
|
|
|
|
void GetGameScreenPointer (int16 *, int16 *, bool);
|
|
|
|
void PostQueueToSubEventLoop (void);
|
|
|
|
int PromptFreezeDefrost (Boolean);
|
2019-09-02 17:20:32 +00:00
|
|
|
uint64 GetMicroseconds(void);
|
|
|
|
|
2019-10-19 14:08:27 +00:00
|
|
|
void CopyPressedKeys(uint8 keys[MAC_MAX_PLAYERS][kNumButtons], uint8 gamepadButtons[MAC_MAX_PLAYERS][kNumButtons]);
|
2019-10-05 20:16:19 +00:00
|
|
|
|
2019-11-10 21:02:21 +00:00
|
|
|
@interface S9xJoypad : NSObject
|
|
|
|
@property (nonatomic, assign) uint32 vendorID;
|
|
|
|
@property (nonatomic, assign) uint32 productID;
|
|
|
|
@property (nonatomic, assign) uint8 index;
|
|
|
|
@property (nonatomic, copy) NSString *name;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface S9xJoypadInput : NSObject
|
|
|
|
@property (nonatomic, assign) uint32 cookie;
|
|
|
|
@property (nonatomic, assign) int32 value;
|
|
|
|
@property (nonatomic, assign) S9xButtonCode buttonCode;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@protocol S9xInputDelegate <NSObject>
|
|
|
|
- (BOOL)handleInput:(S9xJoypadInput *)input fromJoypad:(S9xJoypad *)joypad;
|
|
|
|
@end
|
|
|
|
|
|
|
|
extern id<S9xInputDelegate> inputDelegate;
|
|
|
|
|
2019-09-02 17:20:32 +00:00
|
|
|
@interface S9xEngine : NSObject
|
|
|
|
|
2019-11-10 21:02:21 +00:00
|
|
|
@property (nonatomic, weak) id<S9xInputDelegate> inputDelegate;
|
|
|
|
|
2020-03-19 03:14:57 +00:00
|
|
|
- (void)recreateS9xView;
|
|
|
|
|
2019-09-02 17:20:32 +00:00
|
|
|
- (void)start;
|
2019-09-07 15:38:12 +00:00
|
|
|
- (void)stop;
|
2019-09-02 17:20:32 +00:00
|
|
|
|
2019-11-03 19:13:26 +00:00
|
|
|
- (BOOL)isRunning;
|
2019-10-05 20:16:19 +00:00
|
|
|
- (BOOL)isPaused;
|
|
|
|
- (void)pause;
|
2020-03-19 00:22:51 +00:00
|
|
|
- (void)quit;
|
2019-10-05 20:16:19 +00:00
|
|
|
- (void)resume;
|
|
|
|
|
2019-10-19 14:08:27 +00:00
|
|
|
- (BOOL)setButton:(S9xButtonCode)button forKey:(int16)key player:(int8)player oldButton:(S9xButtonCode *)oldButton oldPlayer:(int8 *)oldPlayer oldKey:(int16 *)oldKey;
|
2019-11-10 21:02:21 +00:00
|
|
|
- (void)clearButton:(S9xButtonCode)button forPlayer:(int8)player;
|
|
|
|
|
|
|
|
- (NSArray<S9xJoypad *> *)listJoypads;
|
|
|
|
- (void)setPlayer:(int8)player forVendorID:(uint32)vendorID productID:(uint32)productID index:(uint32)index oldPlayer:(int8 *)oldPlayer;
|
|
|
|
- (BOOL)setButton:(S9xButtonCode)button forVendorID:(uint32)vendorID productID:(uint32)productID index:(uint32)index cookie:(uint32)cookie value:(int32)value oldButton:(S9xButtonCode *)oldButton;
|
|
|
|
- (void)clearJoypadForVendorID:(uint32)vendorID productID:(uint32)productID index:(uint32)index;
|
|
|
|
- (void)clearJoypadForVendorID:(uint32)vendorID productID:(uint32)productID index:(uint32)index buttonCode:(S9xButtonCode)buttonCode;
|
|
|
|
- (NSArray<S9xJoypadInput *> *)getInputsForVendorID:(uint32)vendorID productID:(uint32)productID index:(uint32)index;
|
|
|
|
|
|
|
|
- (NSString *)labelForVendorID:(uint32)vendorID productID:(uint32)productID cookie:(uint32)cookie value:(int32)value;
|
2019-10-05 20:16:19 +00:00
|
|
|
|
2019-09-04 02:51:25 +00:00
|
|
|
- (BOOL)loadROM:(NSURL *)fileURL;
|
2019-09-02 17:20:32 +00:00
|
|
|
|
2019-11-10 21:02:21 +00:00
|
|
|
- (void)setVideoMode:(int)videoMode;
|
|
|
|
- (void)setShowFPS:(BOOL)showFPS;
|
|
|
|
|
2019-09-02 17:20:32 +00:00
|
|
|
@end
|
2010-09-25 15:46:12 +00:00
|
|
|
|
|
|
|
#endif
|