I don't even know what I'm doing anymore.
This commit is contained in:
parent
9eb2fff01a
commit
5d5cf0fe5d
5 changed files with 95 additions and 104 deletions
|
@ -267,36 +267,7 @@ void jlSoundModStop(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void jlUtilShutdown(void) {
|
int main(void) {
|
||||||
// Clear the display.
|
|
||||||
jlDrawColorSet(0);
|
|
||||||
jlDrawClear();
|
|
||||||
|
|
||||||
// Restore Border
|
|
||||||
jlDisplayBorder((jlBorderColorsE)_jlBorderSaved);
|
|
||||||
jlDisplayPresent();
|
|
||||||
|
|
||||||
// SHR Off
|
|
||||||
asmGrOff();
|
|
||||||
|
|
||||||
asmStop();
|
|
||||||
|
|
||||||
// Shutdown tools
|
|
||||||
NTPShutDown(); // NinjaTracker
|
|
||||||
UnloadOneTool(222);
|
|
||||||
MSShutDown(); // MIDI Synth
|
|
||||||
UnloadOneTool(35);
|
|
||||||
SoundShutDown(); // Sound Tool Set
|
|
||||||
MTShutDown(); // Misc Tools
|
|
||||||
DisposeAll(userid());
|
|
||||||
MMShutDown(userid()); // Memory Manager
|
|
||||||
TLShutDown(); // Tool Locator
|
|
||||||
|
|
||||||
jlUtilDie("Clean Exit.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void jlUtilStartup(char *appTitle) {
|
|
||||||
|
|
||||||
handle tempHandle;
|
handle tempHandle;
|
||||||
ptr ZeroPagePtr;
|
ptr ZeroPagePtr;
|
||||||
|
@ -304,8 +275,6 @@ void jlUtilStartup(char *appTitle) {
|
||||||
char *temp;
|
char *temp;
|
||||||
_jlPascalStringT toolFile;
|
_jlPascalStringT toolFile;
|
||||||
|
|
||||||
(void)appTitle; // Unused on IIgs
|
|
||||||
|
|
||||||
TLStartUp(); // Tool Locator
|
TLStartUp(); // Tool Locator
|
||||||
JOEY_CHECK_TOOL_ERROR("TLStartUp")
|
JOEY_CHECK_TOOL_ERROR("TLStartUp")
|
||||||
MMStartUp(); // Memory Manager
|
MMStartUp(); // Memory Manager
|
||||||
|
@ -374,6 +343,34 @@ void jlUtilStartup(char *appTitle) {
|
||||||
jlDrawColorSet(0);
|
jlDrawColorSet(0);
|
||||||
jlDrawClear();
|
jlDrawClear();
|
||||||
jlDrawColorSet(15);
|
jlDrawColorSet(15);
|
||||||
|
|
||||||
jlDisplayPresent();
|
jlDisplayPresent();
|
||||||
|
|
||||||
|
// Run the main loop.
|
||||||
|
joeyMain();
|
||||||
|
|
||||||
|
// Clear the display.
|
||||||
|
jlDrawColorSet(0);
|
||||||
|
jlDrawClear();
|
||||||
|
|
||||||
|
// Restore Border
|
||||||
|
jlDisplayBorder((jlBorderColorsE)_jlBorderSaved);
|
||||||
|
jlDisplayPresent();
|
||||||
|
|
||||||
|
// SHR Off
|
||||||
|
asmGrOff();
|
||||||
|
|
||||||
|
asmStop();
|
||||||
|
|
||||||
|
// Shutdown tools
|
||||||
|
NTPShutDown(); // NinjaTracker
|
||||||
|
UnloadOneTool(222);
|
||||||
|
MSShutDown(); // MIDI Synth
|
||||||
|
UnloadOneTool(35);
|
||||||
|
SoundShutDown(); // Sound Tool Set
|
||||||
|
MTShutDown(); // Misc Tools
|
||||||
|
DisposeAll(userid());
|
||||||
|
MMShutDown(userid()); // Memory Manager
|
||||||
|
TLShutDown(); // Tool Locator
|
||||||
|
|
||||||
|
jlUtilDie("Clean Exit.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -561,36 +561,29 @@ bool jlUtilMustExit(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void jlUtilShutdown(void) {
|
Uint32 _jlUtilTimer(Uint32 interval, void *param) {
|
||||||
int x;
|
(void)param;
|
||||||
|
_jlTimerValue++;
|
||||||
SDL_RemoveTimer(_jlTimerId);
|
return(interval);
|
||||||
for (x=0; x<_jlControllerCount; x++) {
|
|
||||||
SDL_GameControllerClose(_jlControllers[x]);
|
|
||||||
}
|
|
||||||
_jlControllerCount = 0;
|
|
||||||
jlFree(_jlControllers);
|
|
||||||
jlImgFree(_jlBackingStore);
|
|
||||||
//***TODO*** Sound effects stop?
|
|
||||||
jlSoundModStop();
|
|
||||||
jlSoundMidiStop();
|
|
||||||
Mix_CloseAudio();
|
|
||||||
Mix_Quit();
|
|
||||||
SDL_FreeFormat(_jlPixelFormat);
|
|
||||||
SDL_DestroyTexture(_jlTexture);
|
|
||||||
SDL_DestroyRenderer(_jlRenderer);
|
|
||||||
SDL_DestroyWindow(_jlWindow);
|
|
||||||
SDL_Quit();
|
|
||||||
jlUtilDie("Clean Exit.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void jlUtilStartup(char *appTitle) {
|
juint16 jlUtilTimer(void) {
|
||||||
|
return _jlTimerValue;
|
||||||
|
}
|
||||||
|
|
||||||
int flags;
|
|
||||||
int result;
|
void jlUtilTitleSet(char *title) {
|
||||||
int joysticks;
|
SDL_SetWindowTitle(_jlWindow, title);
|
||||||
int x;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
|
||||||
|
int flags;
|
||||||
|
int result;
|
||||||
|
int joysticks;
|
||||||
|
int x;
|
||||||
|
|
||||||
// Start low-level tools
|
// Start low-level tools
|
||||||
if (SDL_Init(SDL_INIT_EVERYTHING) == -1) {
|
if (SDL_Init(SDL_INIT_EVERYTHING) == -1) {
|
||||||
|
@ -617,7 +610,7 @@ void jlUtilStartup(char *appTitle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a window and renderer using SDL
|
// Create a window and renderer using SDL
|
||||||
_jlWindow = SDL_CreateWindow(appTitle, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 400, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
|
_jlWindow = SDL_CreateWindow("", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 400, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
|
||||||
_jlRenderer = SDL_CreateRenderer(_jlWindow, -1, SDL_RENDERER_SOFTWARE);
|
_jlRenderer = SDL_CreateRenderer(_jlWindow, -1, SDL_RENDERER_SOFTWARE);
|
||||||
_jlTexture = SDL_CreateTexture(_jlRenderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 320, 200);
|
_jlTexture = SDL_CreateTexture(_jlRenderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 320, 200);
|
||||||
_jlPixelFormat = SDL_AllocFormat(SDL_GetWindowPixelFormat(_jlWindow));
|
_jlPixelFormat = SDL_AllocFormat(SDL_GetWindowPixelFormat(_jlWindow));
|
||||||
|
@ -633,16 +626,26 @@ void jlUtilStartup(char *appTitle) {
|
||||||
|
|
||||||
// Start 1/60th second timer
|
// Start 1/60th second timer
|
||||||
_jlTimerId = SDL_AddTimer(1000 / 60, _jlUtilTimer, NULL);
|
_jlTimerId = SDL_AddTimer(1000 / 60, _jlUtilTimer, NULL);
|
||||||
}
|
|
||||||
|
// Run the main loop.
|
||||||
|
joeyMain();
|
||||||
Uint32 _jlUtilTimer(Uint32 interval, void *param) {
|
|
||||||
(void)param;
|
SDL_RemoveTimer(_jlTimerId);
|
||||||
_jlTimerValue++;
|
for (x=0; x<_jlControllerCount; x++) {
|
||||||
return(interval);
|
SDL_GameControllerClose(_jlControllers[x]);
|
||||||
}
|
}
|
||||||
|
_jlControllerCount = 0;
|
||||||
|
jlFree(_jlControllers);
|
||||||
juint16 jlUtilTimer(void) {
|
jlImgFree(_jlBackingStore);
|
||||||
return _jlTimerValue;
|
//***TODO*** Sound effects stop?
|
||||||
|
jlSoundModStop();
|
||||||
|
jlSoundMidiStop();
|
||||||
|
Mix_CloseAudio();
|
||||||
|
Mix_Quit();
|
||||||
|
SDL_FreeFormat(_jlPixelFormat);
|
||||||
|
SDL_DestroyTexture(_jlTexture);
|
||||||
|
SDL_DestroyRenderer(_jlRenderer);
|
||||||
|
SDL_DestroyWindow(_jlWindow);
|
||||||
|
SDL_Quit();
|
||||||
|
jlUtilDie("Clean Exit.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define JOEY_MAIN
|
||||||
#include "joey.h"
|
#include "joey.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -1099,14 +1100,6 @@ void jlUtilRandomSeedSet(juint32 seed) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef JL_HAS_UTILSHUTDOWN
|
|
||||||
__attribute__((noreturn))
|
|
||||||
void jlUtilShutdown(void) {
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef JL_HAS_UTILSLEEP
|
#ifndef JL_HAS_UTILSLEEP
|
||||||
void jlUtilSleep(juint16 sixtieths) {
|
void jlUtilSleep(juint16 sixtieths) {
|
||||||
juint16 t = jlUtilTimer();
|
juint16 t = jlUtilTimer();
|
||||||
|
@ -1145,13 +1138,6 @@ void _jlUtilStackPush(jlStackT **stack, void *data) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef JL_HAS_UTILSTARTUP
|
|
||||||
void jlUtilStartup(char *appTitle) {
|
|
||||||
(void)appTitle;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef JL_HAS_UTILTIMER
|
#ifndef JL_HAS_UTILTIMER
|
||||||
juint16 jlUtilTimer(void) {
|
juint16 jlUtilTimer(void) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1170,6 +1156,13 @@ juint16 jlUtilTimeSpan(juint16 past, juint16 current) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef JL_HAS_UTILHASTITLESET
|
||||||
|
void jlUtilTitleSet(char *title) {
|
||||||
|
(void)title;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef JL_HAS_VECDISPLAY
|
#ifndef JL_HAS_VECDISPLAY
|
||||||
void jlVecDisplay(jlVecT *vec, jint16 ox, jint16 oy) {
|
void jlVecDisplay(jlVecT *vec, jint16 ox, jint16 oy) {
|
||||||
jint16 command;
|
jint16 command;
|
||||||
|
|
|
@ -102,9 +102,8 @@ typedef unsigned int juint32;
|
||||||
#define JL_HAS_SOUNDPLAY
|
#define JL_HAS_SOUNDPLAY
|
||||||
#define JL_HAS_UTILIDLE
|
#define JL_HAS_UTILIDLE
|
||||||
#define JL_HAS_UTILMUSTEXIT
|
#define JL_HAS_UTILMUSTEXIT
|
||||||
#define JL_HAS_UTILSHUTDOWN
|
|
||||||
#define JL_HAS_UTILSTARTUP
|
|
||||||
#define JL_HAS_UTILTIMER
|
#define JL_HAS_UTILTIMER
|
||||||
|
#define JL_HAS_UTILHASTITLESET
|
||||||
|
|
||||||
#elif _WIN32
|
#elif _WIN32
|
||||||
|
|
||||||
|
@ -144,9 +143,8 @@ typedef unsigned int juint32;
|
||||||
#define JL_HAS_SOUNDPLAY
|
#define JL_HAS_SOUNDPLAY
|
||||||
#define JL_HAS_UTILIDLE
|
#define JL_HAS_UTILIDLE
|
||||||
#define JL_HAS_UTILMUSTEXIT
|
#define JL_HAS_UTILMUSTEXIT
|
||||||
#define JL_HAS_UTILSHUTDOWN
|
|
||||||
#define JL_HAS_UTILSTARTUP
|
|
||||||
#define JL_HAS_UTILTIMER
|
#define JL_HAS_UTILTIMER
|
||||||
|
#define JL_HAS_UTILHASTITLESET
|
||||||
|
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
|
|
||||||
|
@ -186,9 +184,8 @@ typedef unsigned int juint32;
|
||||||
#define JL_HAS_SOUNDPLAY
|
#define JL_HAS_SOUNDPLAY
|
||||||
#define JL_HAS_UTILIDLE
|
#define JL_HAS_UTILIDLE
|
||||||
#define JL_HAS_UTILMUSTEXIT
|
#define JL_HAS_UTILMUSTEXIT
|
||||||
#define JL_HAS_UTILSHUTDOWN
|
|
||||||
#define JL_HAS_UTILSTARTUP
|
|
||||||
#define JL_HAS_UTILTIMER
|
#define JL_HAS_UTILTIMER
|
||||||
|
#define JL_HAS_UTILHASTITLESET
|
||||||
|
|
||||||
#elif __ORCAC__
|
#elif __ORCAC__
|
||||||
|
|
||||||
|
@ -232,8 +229,6 @@ typedef unsigned long juint32;
|
||||||
#define JL_HAS_SOUNDMODPLAY
|
#define JL_HAS_SOUNDMODPLAY
|
||||||
#define JL_HAS_SOUNDMODSTOP
|
#define JL_HAS_SOUNDMODSTOP
|
||||||
#define JL_HAS_UTILNIBBLESWAP
|
#define JL_HAS_UTILNIBBLESWAP
|
||||||
#define JL_HAS_UTILSHUTDOWN
|
|
||||||
#define JL_HAS_UTILSTARTUP
|
|
||||||
#define JL_HAS_UTILTIMER
|
#define JL_HAS_UTILTIMER
|
||||||
|
|
||||||
#elif AMIGA
|
#elif AMIGA
|
||||||
|
@ -439,15 +434,14 @@ void jlUtilNibbleSwap(byte *mem, jint16 count, byte old, byte new);
|
||||||
juint16 jlUtilRandom(void);
|
juint16 jlUtilRandom(void);
|
||||||
juint32 jlUtilRandomSeedGet(void);
|
juint32 jlUtilRandomSeedGet(void);
|
||||||
void jlUtilRandomSeedSet(juint32 seed);
|
void jlUtilRandomSeedSet(juint32 seed);
|
||||||
void jlUtilShutdown(void) __attribute__((noreturn));
|
|
||||||
void jlUtilSleep(juint16 sixtieths);
|
void jlUtilSleep(juint16 sixtieths);
|
||||||
#define jlUtilStackPop(stack) _jlUtilStackPop((jlStackT **)&(stack)) // Syntatic Sugar
|
#define jlUtilStackPop(stack) _jlUtilStackPop((jlStackT **)&(stack)) // Syntatic Sugar
|
||||||
void *_jlUtilStackPop(jlStackT **stack);
|
void *_jlUtilStackPop(jlStackT **stack);
|
||||||
#define jlUtilStackPush(stack, data) _jlUtilStackPush((jlStackT **)&(stack), data) // Syntatic Sugar
|
#define jlUtilStackPush(stack, data) _jlUtilStackPush((jlStackT **)&(stack), data) // Syntatic Sugar
|
||||||
void _jlUtilStackPush(jlStackT **stack, void *data);
|
void _jlUtilStackPush(jlStackT **stack, void *data);
|
||||||
void jlUtilStartup(char *appTitle);
|
|
||||||
juint16 jlUtilTimer(void);
|
juint16 jlUtilTimer(void);
|
||||||
juint16 jlUtilTimeSpan(juint16 past, juint16 current);
|
juint16 jlUtilTimeSpan(juint16 past, juint16 current);
|
||||||
|
void jlUtilTitleSet(char *title);
|
||||||
|
|
||||||
void jlVecDisplay(jlVecT *vec, jint16 x, jint16 y);
|
void jlVecDisplay(jlVecT *vec, jint16 x, jint16 y);
|
||||||
void jlVecFree(jlVecT *vec);
|
void jlVecFree(jlVecT *vec);
|
||||||
|
@ -455,6 +449,10 @@ void jlVecFree(jlVecT *vec);
|
||||||
bool _jlVecLoad(jlVecT **vec, char *filename);
|
bool _jlVecLoad(jlVecT **vec, char *filename);
|
||||||
|
|
||||||
|
|
||||||
|
// Must be provided by application
|
||||||
|
void joeyMain(void);
|
||||||
|
|
||||||
|
|
||||||
#ifdef JOEY_IIGS
|
#ifdef JOEY_IIGS
|
||||||
// Inlined functions - asm code
|
// Inlined functions - asm code
|
||||||
extern void asmB88(jlSurfaceT target, jlSurfaceT source, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2);
|
extern void asmB88(jlSurfaceT target, jlSurfaceT source, jint16 cx1, jint16 cy1, jint16 cx2, jint16 cy2);
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
#define JOEY_MAIN
|
|
||||||
#include "joey.h"
|
#include "joey.h"
|
||||||
#ifdef JOEY_IIGS
|
#ifdef JOEY_IIGS
|
||||||
segment "testapp";
|
segment "testapp";
|
||||||
|
@ -437,17 +436,18 @@ void timerTest(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(void) {
|
void joeyMain(void) {
|
||||||
jlUtilStartup("JoeyLib Test");
|
|
||||||
|
jlUtilTitleSet("JoeyLib Test");
|
||||||
|
|
||||||
//blitTest();
|
//blitTest();
|
||||||
//exerciseAPI();
|
//exerciseAPI();
|
||||||
//grid();
|
grid();
|
||||||
//lineTest();
|
//lineTest();
|
||||||
//musicTest();
|
//musicTest();
|
||||||
showStencil();
|
//showStencil();
|
||||||
//stencilTest();
|
//stencilTest();
|
||||||
//timerTest();
|
//timerTest();
|
||||||
|
|
||||||
jlUtilShutdown();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue