mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 11:06:06 -04:00
fix last commit
This commit is contained in:
parent
819fe3f5cf
commit
d92093dc9a
12
src/Audio.c
12
src/Audio.c
@ -100,7 +100,7 @@ void Audio_Open(AudioHandle* handle, int buffers) {
|
||||
Logger_Abort("No free audio contexts");
|
||||
}
|
||||
|
||||
ReturnCode Audio_Free(AudioHandle handle) {
|
||||
ReturnCode Audio_Close(AudioHandle handle) {
|
||||
struct AudioFormat fmt = { 0 };
|
||||
struct AudioContext* ctx;
|
||||
ReturnCode res;
|
||||
@ -274,7 +274,7 @@ void Audio_Open(AudioHandle* handle, int buffers) {
|
||||
Logger_Abort("No free audio contexts");
|
||||
}
|
||||
|
||||
ReturnCode Audio_Free(AudioHandle handle) {
|
||||
ReturnCode Audio_Close(AudioHandle handle) {
|
||||
struct AudioFormat fmt = { 0 };
|
||||
struct AudioContext* ctx;
|
||||
ALenum err;
|
||||
@ -403,11 +403,11 @@ struct AudioFormat* Audio_GetFormat(AudioHandle handle) {
|
||||
return &Audio_Contexts[handle].Format;
|
||||
}
|
||||
|
||||
ReturnCode Audio_StopAndFree(AudioHandle handle) {
|
||||
ReturnCode Audio_StopAndClose(AudioHandle handle) {
|
||||
bool finished;
|
||||
Audio_Stop(handle);
|
||||
Audio_IsFinished(handle, &finished); /* unqueue buffers */
|
||||
return Audio_Free(handle);
|
||||
return Audio_Close(handle);
|
||||
}
|
||||
|
||||
|
||||
@ -678,7 +678,7 @@ static void Sounds_FreeOutputs(struct SoundOutput* outputs) {
|
||||
for (i = 0; i < AUDIO_MAX_HANDLES; i++) {
|
||||
if (outputs[i].Handle == HANDLE_INV) continue;
|
||||
|
||||
Audio_StopAndFree(outputs[i].Handle);
|
||||
Audio_StopAndClose(outputs[i].Handle);
|
||||
outputs[i].Handle = HANDLE_INV;
|
||||
|
||||
Mem_Free(outputs[i].Buffer);
|
||||
@ -855,7 +855,7 @@ static void Music_RunLoop(void) {
|
||||
Chat_AddRaw("&cDisabling music");
|
||||
Audio_MusicVolume = 0;
|
||||
}
|
||||
Audio_StopAndFree(music_out);
|
||||
Audio_StopAndClose(music_out);
|
||||
|
||||
if (music_joining) return;
|
||||
Thread_Detach(music_thread);
|
||||
|
@ -25,13 +25,13 @@ struct AudioFormat { uint16_t Channels, BitsPerSample; int SampleRate; };
|
||||
#define AudioFormat_Eq(a, b) ((a)->Channels == (b)->Channels && (a)->BitsPerSample == (b)->BitsPerSample && (a)->SampleRate == (b)->SampleRate)
|
||||
typedef int AudioHandle;
|
||||
|
||||
/* Allocates an audio context. */
|
||||
/* Acquires an audio context. */
|
||||
void Audio_Open(AudioHandle* handle, int buffers);
|
||||
/* Frees an allocated audio context. */
|
||||
/* NOTE: Audio_StopAndFree should be used, because this method can fail if audio is playing. */
|
||||
ReturnCode Audio_Free(AudioHandle handle);
|
||||
/* NOTE: Audio_StopAndClose should be used, because this method can fail if audio is playing. */
|
||||
ReturnCode Audio_Close(AudioHandle handle);
|
||||
/* Stops playing audio, unqueues buffers, then frees the audio context. */
|
||||
ReturnCode Audio_StopAndFree(AudioHandle handle);
|
||||
ReturnCode Audio_StopAndClose(AudioHandle handle);
|
||||
/* Returns the format audio is played in. */
|
||||
struct AudioFormat* Audio_GetFormat(AudioHandle handle);
|
||||
/* Sets the format audio to play is in. */
|
||||
|
@ -370,6 +370,9 @@ static void Game_LoadOptions(void) {
|
||||
}*/
|
||||
}
|
||||
|
||||
#if defined CC_BUILD_WEB
|
||||
static void Game_LoadPlugins(void) { }
|
||||
#else
|
||||
static void Game_LoadPlugin(const String* path, void* obj) {
|
||||
#if defined CC_BUILD_WIN
|
||||
const static String ext = String_FromConst(".dll");
|
||||
@ -414,6 +417,7 @@ static void Game_LoadPlugins(void) {
|
||||
res = Directory_Enum(&dir, NULL, Game_LoadPlugin);
|
||||
if (res) Logger_Warn(res, "enumerating plugins directory");
|
||||
}
|
||||
#endif
|
||||
|
||||
void Game_Free(void* obj);
|
||||
static void Game_Load(void) {
|
||||
|
@ -692,12 +692,12 @@ void* Thread_Start(Thread_StartFunc* func, bool detach) { (*func)(); return NULL
|
||||
void Thread_Detach(void* handle) { }
|
||||
void Thread_Join(void* handle) { }
|
||||
|
||||
void* Mutex_Create(void) { }
|
||||
void* Mutex_Create(void) { return NULL; }
|
||||
void Mutex_Free(void* handle) { }
|
||||
void Mutex_Lock(void* handle) { }
|
||||
void Mutex_Unlock(void* handle) { }
|
||||
|
||||
void* Waitable_Create(void) { }
|
||||
void* Waitable_Create(void) { eeturn NULL; }
|
||||
void Waitable_Free(void* handle) { }
|
||||
void Waitable_Signal(void* handle) { }
|
||||
void Waitable_Wait(void* handle) { }
|
||||
@ -1486,6 +1486,20 @@ ReturnCode DynamicLib_Get(void* lib, const char* name, void** symbol) {
|
||||
bool DynamicLib_DescribeError(ReturnCode res, String* dst) {
|
||||
return Platform_DescribeError(res, dst);
|
||||
}
|
||||
#elif defined CC_BUILD_WEB
|
||||
ReturnCode Process_GetExePath(String* path) { return ReturnCode_NotSupported; }
|
||||
ReturnCode Process_Start(const String* path, const String* args) { return ReturnCode_NotSupported; }
|
||||
|
||||
ReturnCode Process_StartOpen(const String* args) {
|
||||
char str[600];
|
||||
Platform_ConvertString(str, args);
|
||||
EM_ASM_({ window.open(UTF8ToString($0)); }, str);
|
||||
}
|
||||
void Process_Exit(ReturnCode code) { exit(code); }
|
||||
|
||||
ReturnCode DynamicLib_Load(const String* path, void** lib) { return ReturnCode_NotSupported; }
|
||||
ReturnCode DynamicLib_Get(void* lib, const char* name, void** symbol) { return ReturnCode_NotSupported; }
|
||||
bool DynamicLib_DescribeError(ReturnCode res, String* dst) { return false; }
|
||||
#elif defined CC_BUILD_POSIX
|
||||
ReturnCode Process_Start(const String* path, const String* args) {
|
||||
char str[600], raw[600];
|
||||
@ -1542,14 +1556,7 @@ bool DynamicLib_DescribeError(ReturnCode res, String* dst) {
|
||||
}
|
||||
#endif
|
||||
/* Opening browser and retrieving exe path is not standardised at all */
|
||||
#if defined CC_BUILD_WEB
|
||||
ReturnCode Process_StartOpen(const String* args) {
|
||||
char str[600];
|
||||
Platform_ConvertString(str, args);
|
||||
EM_ASM_({ window.open(UTF8ToString($0)); }, str);
|
||||
}
|
||||
ReturnCode Process_GetExePath(String* path) { return ReturnCode_NotSupported; }
|
||||
#elif defined CC_BUILD_OSX
|
||||
#if defined CC_BUILD_OSX
|
||||
ReturnCode Process_StartOpen(const String* args) {
|
||||
const static String path = String_FromConst("/usr/bin/open");
|
||||
return Process_Start(&path, args);
|
||||
|
58
src/Window.c
58
src/Window.c
@ -714,70 +714,70 @@ static Key Window_MapKey(KeySym key) {
|
||||
case XK_Meta_L: return KEY_LWIN;
|
||||
case XK_Meta_R: return KEY_RWIN;
|
||||
|
||||
case XK_Menu: return KEY_MENU;
|
||||
case XK_Tab: return KEY_TAB;
|
||||
case XK_Menu: return KEY_MENU;
|
||||
case XK_Tab: return KEY_TAB;
|
||||
case XK_minus: return KEY_MINUS;
|
||||
case XK_plus: return KEY_EQUALS;
|
||||
case XK_plus: return KEY_EQUALS;
|
||||
case XK_equal: return KEY_EQUALS;
|
||||
|
||||
case XK_Caps_Lock: return KEY_CAPSLOCK;
|
||||
case XK_Num_Lock: return KEY_NUMLOCK;
|
||||
case XK_Num_Lock: return KEY_NUMLOCK;
|
||||
|
||||
case XK_Pause: return KEY_PAUSE;
|
||||
case XK_Break: return KEY_PAUSE;
|
||||
case XK_Scroll_Lock: return KEY_SCROLLLOCK;
|
||||
case XK_Insert: return KEY_INSERT;
|
||||
case XK_Print: return KEY_PRINTSCREEN;
|
||||
case XK_Insert: return KEY_INSERT;
|
||||
case XK_Print: return KEY_PRINTSCREEN;
|
||||
case XK_Sys_Req: return KEY_PRINTSCREEN;
|
||||
|
||||
case XK_backslash: return KEY_BACKSLASH;
|
||||
case XK_bar: return KEY_BACKSLASH;
|
||||
case XK_braceleft: return KEY_LBRACKET;
|
||||
case XK_bracketleft: return KEY_LBRACKET;
|
||||
case XK_braceright: return KEY_RBRACKET;
|
||||
case XK_bar: return KEY_BACKSLASH;
|
||||
case XK_braceleft: return KEY_LBRACKET;
|
||||
case XK_bracketleft: return KEY_LBRACKET;
|
||||
case XK_braceright: return KEY_RBRACKET;
|
||||
case XK_bracketright: return KEY_RBRACKET;
|
||||
case XK_colon: return KEY_SEMICOLON;
|
||||
case XK_semicolon: return KEY_SEMICOLON;
|
||||
case XK_colon: return KEY_SEMICOLON;
|
||||
case XK_semicolon: return KEY_SEMICOLON;
|
||||
case XK_quoteright: return KEY_QUOTE;
|
||||
case XK_quotedbl: return KEY_QUOTE;
|
||||
case XK_quoteleft: return KEY_TILDE;
|
||||
case XK_quotedbl: return KEY_QUOTE;
|
||||
case XK_quoteleft: return KEY_TILDE;
|
||||
case XK_asciitilde: return KEY_TILDE;
|
||||
|
||||
case XK_comma: return KEY_COMMA;
|
||||
case XK_less: return KEY_COMMA;
|
||||
case XK_period: return KEY_PERIOD;
|
||||
case XK_less: return KEY_COMMA;
|
||||
case XK_period: return KEY_PERIOD;
|
||||
case XK_greater: return KEY_PERIOD;
|
||||
case XK_slash: return KEY_SLASH;
|
||||
case XK_slash: return KEY_SLASH;
|
||||
case XK_question: return KEY_SLASH;
|
||||
|
||||
case XK_Left: return KEY_LEFT;
|
||||
case XK_Down: return KEY_DOWN;
|
||||
case XK_Left: return KEY_LEFT;
|
||||
case XK_Down: return KEY_DOWN;
|
||||
case XK_Right: return KEY_RIGHT;
|
||||
case XK_Up: return KEY_UP;
|
||||
case XK_Up: return KEY_UP;
|
||||
|
||||
case XK_Delete: return KEY_DELETE;
|
||||
case XK_Home: return KEY_HOME;
|
||||
case XK_End: return KEY_END;
|
||||
case XK_Page_Up: return KEY_PAGEUP;
|
||||
case XK_Home: return KEY_HOME;
|
||||
case XK_End: return KEY_END;
|
||||
case XK_Page_Up: return KEY_PAGEUP;
|
||||
case XK_Page_Down: return KEY_PAGEDOWN;
|
||||
|
||||
case XK_KP_Add: return KEY_KP_PLUS;
|
||||
case XK_KP_Subtract: return KEY_KP_MINUS;
|
||||
case XK_KP_Multiply: return KEY_KP_MULTIPLY;
|
||||
case XK_KP_Divide: return KEY_KP_DIVIDE;
|
||||
case XK_KP_Divide: return KEY_KP_DIVIDE;
|
||||
case XK_KP_Decimal: return KEY_KP_DECIMAL;
|
||||
case XK_KP_Insert: return KEY_KP0;
|
||||
case XK_KP_End: return KEY_KP1;
|
||||
case XK_KP_End: return KEY_KP1;
|
||||
case XK_KP_Down: return KEY_KP2;
|
||||
case XK_KP_Page_Down: return KEY_KP3;
|
||||
case XK_KP_Left: return KEY_KP4;
|
||||
case XK_KP_Left: return KEY_KP4;
|
||||
case XK_KP_Begin: return KEY_KP5;
|
||||
case XK_KP_Right: return KEY_KP6;
|
||||
case XK_KP_Home: return KEY_KP7;
|
||||
case XK_KP_Up: return KEY_KP8;
|
||||
case XK_KP_Up: return KEY_KP8;
|
||||
case XK_KP_Page_Up: return KEY_KP9;
|
||||
case XK_KP_Delete: return KEY_KP_DECIMAL;
|
||||
case XK_KP_Enter: return KEY_KP_ENTER;
|
||||
case XK_KP_Delete: return KEY_KP_DECIMAL;
|
||||
case XK_KP_Enter: return KEY_KP_ENTER;
|
||||
}
|
||||
return KEY_NONE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user