Knock out most of the compiler warnings

This commit is contained in:
InvisibleUp 2020-07-11 12:24:29 -04:00
parent 24eeabe9a5
commit 4264ff2de5
21 changed files with 222 additions and 490 deletions

View File

@ -114,9 +114,14 @@ HW_SRC = {
'VIDCARD': [
'src/HW/VIDCARD/VIDEMDEV.c',
],
'RAM': [
],
'ROM': [
'src/HW/ROM/ROMEMDEV.c',
]
}
MAC_SRC_COMMON = HW_SRC['DISK'] + HW_SRC['M68K'] + HW_SRC['RTC'] + HW_SRC['SOUND'] + HW_SRC['VIA1'] + HW_SRC['SCREEN'] + HW_SRC['SCC'] + HW_SRC['SCSI'] + HW_SRC['MOUSE']
MAC_SRC_COMMON = HW_SRC['DISK'] + HW_SRC['M68K'] + HW_SRC['RTC'] + HW_SRC['SOUND'] + HW_SRC['VIA1'] + HW_SRC['SCREEN'] + HW_SRC['SCC'] + HW_SRC['SCSI'] + HW_SRC['MOUSE'] + HW_SRC['ROM']
# Macintosh definitions
MAC_SRC = {
@ -135,7 +140,6 @@ MAC_SRC = {
UI_SRC = [
'src/UI/COMOSGLU.c',
'src/UI/CONTROLM.c',
'src/UI/CONFIGM.c',
'src/UI/SDL2/OSGLUSD2.c',
#'src/UI/SDL2/CLIPBRD.c',
'src/UI/SDL2/DBGLOG.c',

View File

@ -22,6 +22,8 @@
Some code here adapted from "custom.c" in vMac by Philip Cummins,
in turn descended from code in the Un*x Amiga Emulator by
Bernd Schmidt.
TODO: Try to yank as much out of this as we possibly can.
*/
#ifndef AllFiles
@ -43,6 +45,16 @@
ReportAbnormalID ranges unused 0x12xx - 0xFFxx
*/
// Global variables (temporary location?)
bool SpeedStopped = false;
bool RunInBackground = (WantInitRunInBackground != 0);
bool WantFullScreen = (WantInitFullScreen != 0);
bool WantMagnify = (WantInitMagnify != 0);
bool RequestInsertDisk = false;
uint8_t RequestIthDisk = 0;
bool ControlKeyPressed = false;
IMPORTPROC m68k_reset(void);
IMPORTPROC IWM_Reset(void);
IMPORTPROC SCC_Reset(void);

View File

@ -21,6 +21,15 @@
#include "EMCONFIG.h"
#include "SYSDEPNS.h"
// various globals
extern bool SpeedStopped;
extern bool RunInBackground;
extern bool WantFullScreen;
extern bool WantMagnify;
extern bool RequestInsertDisk;
extern uint8_t RequestIthDisk;
extern bool ControlKeyPressed;
#define kEmMd_Twig43 0
#define kEmMd_Twiggy 1
#define kEmMd_128K 2

54
src/HW/ROM/ROMEMDEV.c Normal file
View File

@ -0,0 +1,54 @@
#include <stdint.h>
#include "GLOBGLUE.h"
#include "HW/ROM/ROMEMDEV.h"
#include "UTIL/ENDIANAC.h"
uint8_t * ROM = nullpr;
bool ROM_loaded = false;
uint32_t Calc_Checksum(uint8_t *rom, uint32_t len)
{
uint32_t i;
uint32_t CheckSum = 0;
uint8_t * p = 4 + rom;
for (i = (len - 4) >> 1; --i >= 0; ) {
CheckSum += do_get_mem_word(p);
p += 2;
}
return CheckSum;
}
bool ROM_IsValid(void)
{
/*if(CheckRomCheckSum) {
uint32_t CheckSum = Calc_Checksum();
if (CheckSum != do_get_mem_long(ROM)) {
// Check against internal checksum
WarnMsgCorruptedROM();
return mnvm_miscErr;
} else if (!(
CheckSum == kRomCheckSum1 ||
CheckSum == kRomCheckSum2 ||
CheckSum == kRomCheckSum3
)) {
// Unsupported ROM
WarnMsgUnsupportedROM();
return mnvm_miscErr;
}
}*/
ROM_loaded = true;
SpeedStopped = false;
return true;
}
// Loop for when there's nothing to do but tell the user they're missing a ROM
// TODO: Hijack this for config mode?
bool WaitForRom(void)
{
return true;
}

9
src/HW/ROM/ROMEMDEV.h Normal file
View File

@ -0,0 +1,9 @@
#include <stdint.h>
#include <stdbool.h>
extern uint8_t * ROM;
extern bool ROM_loaded;
uint32_t Calc_Checksum(uint8_t *rom, uint32_t len);
bool ROM_IsValid(void);
bool WaitForRom(void);

View File

@ -26,9 +26,6 @@
#include "COMOSGLU.h"
#include "HW/SCREEN/SCRNEMDV.h"
GLOBALVAR uint8_t * ROM = nullpr;
GLOBALVAR bool ROM_loaded = false;
GLOBALVAR uint32_t vSonyWritableMask = 0;
GLOBALVAR uint32_t vSonyInsertedMask = 0;
@ -168,313 +165,12 @@ GLOBALPROC DiskEjectedNotify(tDrive Drive_No)
vSonyInsertedMask &= ~ ((uint32_t)1 << Drive_No);
}
LOCALFUNC bool FindFirstChangeInLVecs(uibb *ptr1, uibb *ptr2,
uimr L, uimr *j)
{
/*
find index of first difference
*/
uibb *p1 = ptr1;
uibb *p2 = ptr2;
uimr i;
for (i = L; i != 0; --i) {
if (*p1++ != *p2++) {
--p1;
*j = p1 - ptr1;
return true;
}
}
return false;
}
LOCALPROC FindLastChangeInLVecs(uibb *ptr1, uibb *ptr2,
uimr L, uimr *j)
{
/*
find index of last difference, assuming there is one
*/
uibb *p1 = ptr1 + L;
uibb *p2 = ptr2 + L;
while (*--p1 == *--p2) {
}
*j = p1 - ptr1;
}
LOCALPROC FindLeftRightChangeInLMat(uibb *ptr1, uibb *ptr2,
uimr width, uimr top, uimr bottom,
uimr *LeftMin0, uibr *LeftMask0,
uimr *RightMax0, uibr *RightMask0)
{
uimr i;
uimr j;
uibb *p1;
uibb *p2;
uibr x;
uint32_t offset = top * width;
uibb *p10 = (uibb *)ptr1 + offset;
uibb *p20 = (uibb *)ptr2 + offset;
uimr LeftMin = *LeftMin0;
uimr RightMax = *RightMax0;
uibr LeftMask = 0;
uibr RightMask = 0;
for (i = top; i < bottom; ++i) {
p1 = p10;
p2 = p20;
for (j = 0; j < LeftMin; ++j) {
x = *p1++ ^ *p2++;
if (0 != x) {
LeftMin = j;
LeftMask = x;
goto Label_3;
}
}
LeftMask |= (*p1 ^ *p2);
Label_3:
p1 = p10 + RightMax;
p2 = p20 + RightMax;
RightMask |= (*p1++ ^ *p2++);
for (j = RightMax + 1; j < width; ++j) {
x = *p1++ ^ *p2++;
if (0 != x) {
RightMax = j;
RightMask = x;
}
}
p10 += width;
p20 += width;
}
*LeftMin0 = LeftMin;
*RightMax0 = RightMax;
*LeftMask0 = LeftMask;
*RightMask0 = RightMask;
}
GLOBALVAR uint8_t * screencomparebuff = nullpr;
LOCALVAR uimr NextDrawRow = 0;
#if WantColorTransValid
LOCALVAR bool ColorTransValid = false;
#endif
LOCALFUNC bool ScreenFindChanges(uint8_t * screencurrentbuff,
int8_t TimeAdjust, int16_t *top, int16_t *left, int16_t *bottom, int16_t *right)
{
uimr j0;
uimr j1;
uimr j0h;
uimr j1h;
uimr j0v;
uimr j1v;
uimr copysize;
uimr copyoffset;
uimr copyrows;
uimr LimitDrawRow;
uimr MaxRowsDrawnPerTick;
uimr LeftMin;
uimr RightMax;
uibr LeftMask;
uibr RightMask;
int j;
if (TimeAdjust < 4) {
MaxRowsDrawnPerTick = vMacScreenHeight;
} else if (TimeAdjust < 6) {
MaxRowsDrawnPerTick = vMacScreenHeight / 2;
} else {
MaxRowsDrawnPerTick = vMacScreenHeight / 4;
}
if (UseColorMode && vMacScreenDepth > 0) {
if (ColorMappingChanged) {
ColorMappingChanged = false;
j0h = 0;
j1h = vMacScreenWidth;
j0v = 0;
j1v = vMacScreenHeight;
#if WantColorTransValid
ColorTransValid = false;
#endif
} else {
if (! FindFirstChangeInLVecs(
(uibb *)screencurrentbuff
+ NextDrawRow * (vMacScreenBitWidth / uiblockbitsn),
(uibb *)screencomparebuff
+ NextDrawRow * (vMacScreenBitWidth / uiblockbitsn),
((uimr)(vMacScreenHeight - NextDrawRow)
* (uimr)vMacScreenBitWidth) / uiblockbitsn,
&j0))
{
NextDrawRow = 0;
return false;
}
j0v = j0 / (vMacScreenBitWidth / uiblockbitsn);
j0h = j0 - j0v * (vMacScreenBitWidth / uiblockbitsn);
j0v += NextDrawRow;
LimitDrawRow = j0v + MaxRowsDrawnPerTick;
if (LimitDrawRow >= vMacScreenHeight) {
LimitDrawRow = vMacScreenHeight;
NextDrawRow = 0;
} else {
NextDrawRow = LimitDrawRow;
}
FindLastChangeInLVecs((uibb *)screencurrentbuff,
(uibb *)screencomparebuff,
((uimr)LimitDrawRow
* (uimr)vMacScreenBitWidth) / uiblockbitsn,
&j1);
j1v = j1 / (vMacScreenBitWidth / uiblockbitsn);
j1h = j1 - j1v * (vMacScreenBitWidth / uiblockbitsn);
j1v++;
if (j0h < j1h) {
LeftMin = j0h;
RightMax = j1h;
} else {
LeftMin = j1h;
RightMax = j0h;
}
FindLeftRightChangeInLMat((uibb *)screencurrentbuff,
(uibb *)screencomparebuff,
(vMacScreenBitWidth / uiblockbitsn),
j0v, j1v, &LeftMin, &LeftMask, &RightMax, &RightMask);
if (vMacScreenDepth > ln2uiblockbitsn) {
j0h = (LeftMin >> (vMacScreenDepth - ln2uiblockbitsn));
} else if (ln2uiblockbitsn > vMacScreenDepth) {
for (j = 0; j < (1 << (ln2uiblockbitsn - vMacScreenDepth));
++j)
{
if (0 != (LeftMask
& (((((uibr)1) << (1 << vMacScreenDepth)) - 1)
<< ((j ^ FlipCheckBits) << vMacScreenDepth))))
{
goto Label_1c;
}
}
Label_1c:
j0h = (LeftMin << (ln2uiblockbitsn - vMacScreenDepth)) + j;
} else {
j0h = LeftMin;
}
if (vMacScreenDepth > ln2uiblockbitsn) {
j1h = (RightMax >> (vMacScreenDepth - ln2uiblockbitsn)) + 1;
} else if (ln2uiblockbitsn > vMacScreenDepth) {
for (j = (uiblockbitsn >> vMacScreenDepth); --j >= 0; ) {
if (0 != (RightMask
& (((((uibr)1) << (1 << vMacScreenDepth)) - 1)
<< ((j ^ FlipCheckBits) << vMacScreenDepth))))
{
goto Label_2c;
}
}
Label_2c:
j1h = (RightMax << (ln2uiblockbitsn - vMacScreenDepth)) + j + 1;
} else {
j1h = RightMax + 1;
}
}
copyrows = j1v - j0v;
copyoffset = j0v * vMacScreenByteWidth;
copysize = copyrows * vMacScreenByteWidth;
} else {
if (vMacScreenDepth > 0 && ColorMappingChanged) {
ColorMappingChanged = false;
j0h = 0;
j1h = vMacScreenWidth;
j0v = 0;
j1v = vMacScreenHeight;
#if WantColorTransValid
ColorTransValid = false;
#endif
} else {
if (! FindFirstChangeInLVecs(
(uibb *)screencurrentbuff
+ NextDrawRow * (vMacScreenWidth / uiblockbitsn),
(uibb *)screencomparebuff
+ NextDrawRow * (vMacScreenWidth / uiblockbitsn),
((uimr)(vMacScreenHeight - NextDrawRow)
* (uimr)vMacScreenWidth) / uiblockbitsn,
&j0))
{
NextDrawRow = 0;
return false;
}
j0v = j0 / (vMacScreenWidth / uiblockbitsn);
j0h = j0 - j0v * (vMacScreenWidth / uiblockbitsn);
j0v += NextDrawRow;
LimitDrawRow = j0v + MaxRowsDrawnPerTick;
if (LimitDrawRow >= vMacScreenHeight) {
LimitDrawRow = vMacScreenHeight;
NextDrawRow = 0;
} else {
NextDrawRow = LimitDrawRow;
}
FindLastChangeInLVecs((uibb *)screencurrentbuff,
(uibb *)screencomparebuff,
((uimr)LimitDrawRow
* (uimr)vMacScreenWidth) / uiblockbitsn,
&j1);
j1v = j1 / (vMacScreenWidth / uiblockbitsn);
j1h = j1 - j1v * (vMacScreenWidth / uiblockbitsn);
j1v++;
if (j0h < j1h) {
LeftMin = j0h;
RightMax = j1h;
} else {
LeftMin = j1h;
RightMax = j0h;
}
FindLeftRightChangeInLMat((uibb *)screencurrentbuff,
(uibb *)screencomparebuff,
(vMacScreenWidth / uiblockbitsn),
j0v, j1v, &LeftMin, &LeftMask, &RightMax, &RightMask);
for (j = 0; j < uiblockbitsn; ++j) {
if (0 != (LeftMask
& (((uibr)1) << (j ^ FlipCheckMonoBits))))
{
goto Label_1;
}
}
Label_1:
j0h = LeftMin * uiblockbitsn + j;
for (j = uiblockbitsn; --j >= 0; ) {
if (0 != (RightMask
& (((uibr)1) << (j ^ FlipCheckMonoBits))))
{
goto Label_2;
}
}
Label_2:
j1h = RightMax * uiblockbitsn + j + 1;
}
copyrows = j1v - j0v;
copyoffset = j0v * vMacScreenMonoByteWidth;
copysize = copyrows * vMacScreenMonoByteWidth;
}
MoveBytes((anyp)screencurrentbuff + copyoffset,
(anyp)screencomparebuff + copyoffset,
copysize);
*top = j0v;
*left = j0h;
*bottom = j1v;
*right = j1h;
return true;
}
GLOBALVAR bool EmVideoDisable = false;
GLOBALVAR int8_t EmLagTime = 0;
GLOBALVAR uint32_t OnTrueTime = 0;

View File

@ -27,9 +27,6 @@
#include "MYOSGLUE.h"
#define EnableRecreateW 1
extern GLOBALVAR uint8_t * ROM;
extern GLOBALVAR bool ROM_loaded;
extern GLOBALVAR uint32_t vSonyWritableMask;
extern GLOBALVAR uint32_t vSonyInsertedMask;
@ -212,6 +209,7 @@ extern GLOBALVAR bool EvtQNeedRecover;
GLOBALPROC Keyboard_UpdateKeyMap(uint8_t key, bool down);
GLOBALPROC MouseButtonSet(bool down);
GLOBALPROC MousePositionSet(uint16_t h, uint16_t v);
GLOBALPROC MousePositionNotify(int h, int v);
GLOBALPROC InitKeyCodes(void);
GLOBALPROC DisconnectKeyCodes(uint32_t KeepMask);
GLOBALPROC EvtQTryRecoverFromFull(void);

View File

@ -1,23 +0,0 @@
/*
* CONFIG Mode
*
* A replacement for Control Mode, with prettier graphics and actual settings
*
*/
#include <SDL.h> // everything else is deprecated now
#include <stdlib.h>
#include <stdint.h>
#include "CONFIGM.h"
#include "UI/SDL2/OSGLUSD2.h"
/* -- Public Functions -- */
void ConfigMode_Tick()
{
// Get the screen context and just draw something there for now
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
const SDL_Rect rect = {.x = 16, .y = 16, .w = 128, .h = 128};
SDL_RenderDrawRect(renderer, &rect);
}

View File

@ -1,11 +0,0 @@
/*
* CONFIG Mode
*
* A replacement for Control Mode, with prettier grapgics and actual settings
*
*/
/* -- functions -- */
// Run this once every frame, I guess
void ConfigMode_Tick();

View File

@ -30,7 +30,7 @@
#include "UTIL/ENDIANAC.h"
#include "UI/CONTROLM.h"
#include <SDL.h>
#include <SDL2/SDL.h>
#include "UI/SDL2/OSGLUSD2.h"
/* Constants and globals */
@ -51,28 +51,6 @@ typedef void (*SpclModeBody) (void);
#define Keyboard_UpdateKeyMap1 Keyboard_UpdateKeyMap
#define DisconnectKeyCodes1 DisconnectKeyCodes
bool SpeedStopped = false;
bool RunInBackground = (WantInitRunInBackground != 0);
bool WantFullScreen = (WantInitFullScreen != 0);
bool WantMagnify = (WantInitMagnify != 0);
bool RequestInsertDisk = false;
uint8_t RequestIthDisk = 0;
bool ControlKeyPressed = false;
static uint32_t Calc_Checksum(void)
{
long int i;
uint32_t CheckSum = 0;
uint8_t * p = 4 + ROM;
for (i = (kCheckSumRom_Size - 4) >> 1; --i >= 0; ) {
CheckSum += do_get_mem_word(p);
p += 2;
}
return CheckSum;
}
void MacMsgOverride(char *title, char *msg)
{
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title, msg, main_wind);
@ -89,35 +67,3 @@ LOCALPROC WarnMsgUnsupportedROM(void)
kStrUnsupportedROMMessage);
}
MacErr_t ROM_IsValid(void)
{
/*if(CheckRomCheckSum) {
uint32_t CheckSum = Calc_Checksum();
if (CheckSum != do_get_mem_long(ROM)) {
// Check against internal checksum
WarnMsgCorruptedROM();
return mnvm_miscErr;
} else if (!(
CheckSum == kRomCheckSum1 ||
CheckSum == kRomCheckSum2 ||
CheckSum == kRomCheckSum3
)) {
// Unsupported ROM
WarnMsgUnsupportedROM();
return mnvm_miscErr;
}
}*/
ROM_loaded = true;
SpeedStopped = false;
return mnvm_noErr;
}
// Loop for when there's nothing to do but tell the user they're missing a ROM
// TODO: Hijack this for config mode?
bool WaitForRom(void)
{
return true;
}

View File

@ -8,29 +8,13 @@
#include "SYSDEPNS.h"
#include "ERRCODES.h"
#ifndef CheckRomCheckSum
#define CheckRomCheckSum 1
#endif
#ifndef NeedRequestIthDisk
#define NeedRequestIthDisk 0
#endif
/* Globals */
extern uimr SpecialModes;
extern bool NeedWholeScreenDraw;
extern uint8_t * CntrlDisplayBuff;
extern bool ControlKeyPressed;
extern bool RequestInsertDisk;
extern bool WantMagnify;
extern bool RunInBackground;
extern bool SpeedStopped;
extern bool WantFullScreen;
/* Public Functions */
void MacMsgOverride(char *title, char *msg);
MacErr_t ROM_IsValid(void);
bool WaitForRom(void);
#endif // CONTROLM_H

View File

@ -228,4 +228,39 @@ typedef struct EvtQEl EvtQEl;
EXPORTOSGLUFUNC EvtQEl * EvtQOutP(void);
EXPORTOSGLUPROC EvtQOutDone(void);
/*** Might be SDL2-specific? ***/
// INTL.c
void NativeStrFromCStr(char *r, char *s);
// DRIVES.c
void InitDrives();
bool Sony_Insert1a(char *drivepath, bool silentfail);
bool LoadInitialImages();
void UnInitDrives();
// MOUSE.c
void ForceShowCursor();
void CheckMouseState();
// KEYBOARD.c
void DisconnectKeyCodes3();
void ReconnectKeyCodes3();
void DisableKeyRepeat();
void RestoreKeyRepeat();
// SOUND.c
void Sound_Start();
void Sound_Stop();
void Sound_SecondNotify();
bool Sound_Init();
void Sound_UnInit();
// TIMEDATE.c
void StartUpTimeAdjust();
bool UpdateTrueEmulatedTime();
bool CheckDateTime();
bool InitLocationDat();
void IncrNextTime(void);
// ROM.c
bool LoadMacRom();
MacErr_t LoadMacRomFrom(char *path);
// OSGLUSD2.c
void EnterSpeedStopped();
void LeaveSpeedStopped();
#endif

View File

@ -1,7 +1,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <SDL.h>
#include <SDL2/SDL.h>
#include "CNFGRAPI.h"
#include "EMCONFIG.h"
#include "SYSDEPNS.h"
@ -9,42 +9,14 @@
#include "UI/MYOSGLUE.h"
#include "UI/COMOSGLU.h"
#include "STRCONST.h"
#include "HW/ROM/ROMEMDEV.h"
#include "UI/CONTROLM.h"
#include "UI/SDL2/OSGLUSD2.h"
/* --- drives --- */
#define NotAfileRef NULL
#ifndef UseRWops
#define UseRWops 0
#endif
#if UseRWops
#define FilePtr SDL_RWops *
#define Seek SDL_RWseek
#define SeekSet RW_SEEK_SET
#define SeekCur RW_SEEK_CUR
#define SeekEnd RW_SEEK_END
#define FileRead(ptr, size, nmemb, stream) \
SDL_RWread(stream, ptr, size, nmemb)
#define FileWrite(ptr, size, nmemb, stream) \
SDL_RWwrite(stream, ptr, size, nmemb)
#define FileTell SDL_RWtell
#define FileClose SDL_RWclose
#define FileOpen SDL_RWFromFile
#else
#define FilePtr FILE *
#define Seek fseek
#define SeekSet SEEK_SET
#define SeekCur SEEK_CUR
#define SeekEnd SEEK_END
#define FileRead fread
#define FileWrite fwrite
#define FileTell ftell
#define FileClose fclose
#define FileOpen fopen
#define FileEof feof
#endif
FilePtr Drives[NumDrives]; /* open disk image files */
void InitDrives(void)
@ -190,41 +162,6 @@ bool Sony_Insert1(char *drivepath, bool silentfail)
return false;
}
MacErr_t LoadMacRomFrom(char *path)
{
MacErr_t err;
FilePtr ROM_File;
int File_Size;
ROM_File = FileOpen(path, "rb");
if (NULL == ROM_File) {
err = mnvm_fnfErr;
} else {
File_Size = FileRead(ROM, 1, kROM_Size, ROM_File);
if (File_Size != kROM_Size) {
#ifdef FileEof
if (FileEof(ROM_File))
#else
if (File_Size > 0)
#endif
{
MacMsgOverride(kStrShortROMTitle,
kStrShortROMMessage);
err = mnvm_eofErr;
} else {
MacMsgOverride(kStrNoReadROMTitle,
kStrNoReadROMMessage);
err = mnvm_miscErr;
}
} else {
err = ROM_IsValid();
}
FileClose(ROM_File);
}
return err;
}
bool Sony_Insert1a(char *drivepath, bool silentfail)
{
bool v;

View File

@ -1,10 +1,11 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <SDL.h>
#include <SDL2/SDL.h>
#include "CNFGRAPI.h"
#include "EMCONFIG.h"
#include "SYSDEPNS.h"
#include "UI/COMOSGLU.h"
#include "UTIL/ENDIANAC.h"
#include "UI/MYOSGLUE.h"
#include "STRCONST.h"

View File

@ -1,7 +1,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <SDL.h>
#include <SDL2/SDL.h>
#include "CNFGRAPI.h"
#include "SYSDEPNS.h"
#include "UTIL/ENDIANAC.h"

View File

@ -33,6 +33,7 @@
#include "OSGLUSD2.h"
#include "LANG/INTLCHAR.h"
#include "HW/SCREEN/SCRNEMDV.h"
#include "HW/ROM/ROMEMDEV.h"
#include "CFGMAN.h"
/* --- some simple utilities --- */
@ -768,7 +769,7 @@ LOCALPROC EnterBackground(void)
ForceShowCursor();
}
LOCALPROC LeaveSpeedStopped(void)
void LeaveSpeedStopped(void)
{
#if SoundEnabled
Sound_Start();
@ -777,7 +778,7 @@ LOCALPROC LeaveSpeedStopped(void)
StartUpTimeAdjust();
}
LOCALPROC EnterSpeedStopped(void)
void EnterSpeedStopped(void)
{
#if SoundEnabled
Sound_Stop();

View File

@ -2,7 +2,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <SDL.h>
#include <SDL2/SDL.h>
#include "UI/MYOSGLUE.h"
/* --- defines and macros and such --- */
@ -46,6 +46,38 @@
#define dbglog_SoundStuff (0 && dbglog_HAVE)
#define dbglog_SoundBuffStats (0 && dbglog_HAVE)
#ifndef UseRWops
#define UseRWops 0
#endif
#if UseRWops
#define FilePtr SDL_RWops *
#define Seek SDL_RWseek
#define SeekSet RW_SEEK_SET
#define SeekCur RW_SEEK_CUR
#define SeekEnd RW_SEEK_END
#define FileRead(ptr, size, nmemb, stream) \
SDL_RWread(stream, ptr, size, nmemb)
#define FileWrite(ptr, size, nmemb, stream) \
SDL_RWwrite(stream, ptr, size, nmemb)
#define FileTell SDL_RWtell
#define FileClose SDL_RWclose
#define FileOpen SDL_RWFromFile
#else
#define FilePtr FILE *
#define Seek fseek
#define SeekSet SEEK_SET
#define SeekCur SEEK_CUR
#define SeekEnd SEEK_END
#define FileRead fread
#define FileWrite fwrite
#define FileTell ftell
#define FileClose fclose
#define FileOpen fopen
#define FileEof feof
#endif
/* --- globals --- */
@ -77,3 +109,7 @@ extern bool HaveCursorHidden;
extern bool WantCursorHidden;
extern tpSoundSamp TheSoundBuffer;
// Functions
void DoKeyCode(SDL_Keysym *r, bool down);

View File

@ -2,8 +2,13 @@
#include <string.h>
#include <stdio.h>
#include "SYSDEPNS.h"
#include "ERRCODES.h"
#include "STRCONST.h"
#include "UI/MYOSGLUE.h"
#include "UI/COMOSGLU.h"
#include "UI/CONTROLM.h"
#include "UI/SDL2/OSGLUSD2.h"
#include "HW/ROM/ROMEMDEV.h"
/* --- ROM --- */
@ -81,3 +86,39 @@ bool LoadMacRom(void)
return true; /* keep launching Mini vMac, regardless */
}
MacErr_t LoadMacRomFrom(char *path)
{
MacErr_t err;
FilePtr ROM_File;
int File_Size;
ROM_File = FileOpen(path, "rb");
if (NULL == ROM_File) {
err = mnvm_fnfErr;
} else {
File_Size = FileRead(ROM, 1, kROM_Size, ROM_File);
if (File_Size != kROM_Size) {
#ifdef FileEof
if (FileEof(ROM_File))
#else
if (File_Size > 0)
#endif
{
MacMsgOverride(kStrShortROMTitle,
kStrShortROMMessage);
err = mnvm_eofErr;
} else {
MacMsgOverride(kStrNoReadROMTitle,
kStrNoReadROMMessage);
err = mnvm_miscErr;
}
} else {
err = ROM_IsValid();
}
FileClose(ROM_File);
}
return err;
}

View File

@ -1,7 +1,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <SDL.h>
#include <SDL2/SDL.h>
#include "CNFGRAPI.h"
#include "SYSDEPNS.h"
#include "UTIL/ENDIANAC.h"

View File

@ -1,7 +1,8 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <SDL.h>
#include <stdint.h>
#include <SDL2/SDL.h>
#include "CNFGRAPI.h"
#include "SYSDEPNS.h"
#include "UTIL/ENDIANAC.h"

View File

@ -117,6 +117,8 @@ GLOBALOSGLUPROC Screen_OutputFrame(uint8_t * src_ptr)
// Blit src to dst
SDL_BlitSurface(src, NULL, dst, NULL);
// For teh lulz, try a crappy blur
//blur(dst, 1);
// Free surfaces
SDL_FreeSurface(src);