diff --git a/docs/reference/files/config.ini b/docs/reference/files/config-game.ini similarity index 87% rename from docs/reference/files/config.ini rename to docs/reference/files/config-game.ini index 0337383..8cc5cb4 100644 --- a/docs/reference/files/config.ini +++ b/docs/reference/files/config-game.ini @@ -1,57 +1,60 @@ -[Video] -Width=320 -Height=240 -MaxFps=30 -[Joystick.0.ControlMapping] -Affirm=11 -Negate=10 -Action0=1 -Action1=0 -Action2=4 -Action3=3 -Action4=6 -Action5=7 -Action6=8 -Action7=9 -Action8=13 -Action9=14 -[Joystick.0] -DeviceID=0 -AxisThreshold=8000 -[Keyboard.0.ControlMapping] -Up=Up -Right=Right -Down=Down -Left=Left -Affirm=Return -Negate=Backspace -Action0=A -Action1=S -Action2=D -Action3=F -Action4=Z -Action5=X -Action6=C -Action7=V -Action8=W -Action9=E -[MIDIInput.0.ControlMapping] -Up="A#5" -Right=C6 -Down=B5 -Left=A5 -Affirm=F5 -Negate=E5 -Action0=C4 -Action1="C#4" -Action2=D4 -Action3="D#4" -Action4=E4 -Action5=F4 -Action6="F#4" -Action7=G4 -Action8="G#4" -Action9=A4 -[MIDIInput.0] -Channel=0 -DeviceID=0 +[Video] +Width=320 +Height=240 +MaxFps=30 +[Joystick.0.ControlMapping] +Affirm=11 +Negate=10 +Action0=1 +Action1=0 +Action2=4 +Action3=3 +Action4=6 +Action5=7 +Action6=8 +Action7=9 +Action8=13 +Action9=14 +[Joystick.0] +DeviceID=0 +AxisThreshold=8000 +[Keyboard.0.ControlMapping] +Up=Up +Right=Right +Down=Down +Left=Left +Affirm=Return +Negate=Backspace +Action0=A +Action1=S +Action2=D +Action3=F +Action4=Z +Action5=X +Action6=C +Action7=V +Action8=W +Action9=E +[MIDIInput.0.ControlMapping] +Up="A#5" +Right=C6 +Down=B5 +Left=A5 +Affirm=F5 +Negate=E5 +Action0=C4 +Action1="C#4" +Action2=D4 +Action3="D#4" +Action4=E4 +Action5=F4 +Action6="F#4" +Action7=G4 +Action8="G#4" +Action9=A4 +[MIDIInput.0] +Channel=0 +DeviceID=0 +[Network] +Username=Player +Interval=200 diff --git a/docs/reference/files/config-server.ini b/docs/reference/files/config-server.ini new file mode 100644 index 0000000..eb171e1 --- /dev/null +++ b/docs/reference/files/config-server.ini @@ -0,0 +1,4 @@ +[Network] +Name=Izanagi +Motd= +Port=42069 diff --git a/src/packages/game/input/IZ_midi.h b/src/packages/game/input/IZ_midi.h index 751b8fc..351151d 100644 --- a/src/packages/game/input/IZ_midi.h +++ b/src/packages/game/input/IZ_midi.h @@ -15,12 +15,6 @@ #define MIDI_EVENT_BUFFER_SIZE 1024 -typedef u8 IZ_MIDINote; - -static const u8 IZ_MIDI_NOTE_ON = 0x90u; - -static const u8 IZ_MIDI_NOTE_OFF = 0x80u; - typedef struct { PmDeviceID device_id; u8 channel; diff --git a/src/packages/game/input/input.test.c b/src/packages/game/input/input.test.c index 6ef1220..4d5a374 100644 --- a/src/packages/game/input/input.test.c +++ b/src/packages/game/input/input.test.c @@ -41,7 +41,7 @@ spec("input") { } it("sets initial state") { - IZ_JoystickInitialize(&state, "config.ini", 0, NULL); + IZ_JoystickInitialize(&state, "config-game.ini", 0, NULL); check(mock_is_called(SDL_memcpy), "Initial state not loaded."); check(mock_is_called(SDL_NumJoysticks), "Connected joysticks not checked."); @@ -50,7 +50,7 @@ spec("input") { it("calls load method") { mock_set_expected_calls(ini_getl, ((CONTROLS - 4) + 2) * IZ_PLAYERS); - IZ_JoystickInitialize(&state, "config.ini", 0, NULL); + IZ_JoystickInitialize(&state, "config-game.ini", 0, NULL); check( mock_get_expected_calls(ini_getl) == mock_get_actual_calls(ini_getl), @@ -63,7 +63,7 @@ spec("input") { it("calls save method") { mock_set_expected_calls(ini_putl, ((CONTROLS - 4) + 2) * IZ_PLAYERS); - IZ_JoystickInitialize(&state, "config.ini", 0, NULL); + IZ_JoystickInitialize(&state, "config-game.ini", 0, NULL); check( mock_get_expected_calls(ini_putl) == mock_get_actual_calls(ini_putl), @@ -76,7 +76,7 @@ spec("input") { it("opens device handles") { mock_set_expected_calls(SDL_JoystickOpen, MOCK_OPEN_JOYSTICKS); - IZ_JoystickInitialize(&state, "config.ini", 0, NULL); + IZ_JoystickInitialize(&state, "config-game.ini", 0, NULL); check( mock_get_expected_calls(SDL_JoystickOpen) == mock_get_actual_calls(SDL_JoystickOpen), @@ -351,7 +351,7 @@ spec("input") { it("calls save method") { mock_set_expected_calls(ini_putl, ((CONTROLS - 4) + 2) * IZ_PLAYERS); - IZ_JoystickSaveConfig(&state, "config.ini"); + IZ_JoystickSaveConfig(&state, "config-game.ini"); check( mock_get_expected_calls(ini_putl) == mock_get_actual_calls(ini_putl), @@ -416,7 +416,7 @@ spec("input") { } it("sets initial state") { - IZ_KeyboardInitialize(&state, "config.ini", 0, NULL); + IZ_KeyboardInitialize(&state, "config-game.ini", 0, NULL); check(mock_is_called(SDL_memcpy), "Initial state not loaded."); } @@ -424,7 +424,7 @@ spec("input") { it("calls load method") { mock_set_expected_calls(ini_gets, CONTROLS * IZ_PLAYERS); - IZ_KeyboardInitialize(&state, "config.ini", 0, NULL); + IZ_KeyboardInitialize(&state, "config-game.ini", 0, NULL); check( mock_get_expected_calls(ini_gets) == mock_get_actual_calls(ini_gets), @@ -437,7 +437,7 @@ spec("input") { it("calls save method") { mock_set_expected_calls(ini_puts, CONTROLS * IZ_PLAYERS); - IZ_KeyboardInitialize(&state, "config.ini", 0, NULL); + IZ_KeyboardInitialize(&state, "config-game.ini", 0, NULL); check( mock_get_expected_calls(ini_puts) == mock_get_actual_calls(ini_puts), @@ -504,7 +504,7 @@ spec("input") { it("calls save method") { mock_set_expected_calls(ini_puts, CONTROLS * IZ_PLAYERS); - IZ_KeyboardSaveConfig("config.ini", &state); + IZ_KeyboardSaveConfig("config-game.ini", &state); check( mock_get_expected_calls(ini_puts) == mock_get_actual_calls(ini_puts), @@ -549,7 +549,7 @@ spec("input") { } it("sets initial state") { - IZ_MIDIInputInitialize(&state, "config.ini", 0, NULL); + IZ_MIDIInputInitialize(&state, "config-game.ini", 0, NULL); check(mock_is_called(SDL_memcpy), "Initial state not loaded."); check(mock_is_called(Pm_CountDevices), "Connected MIDI devices not checked."); @@ -559,7 +559,7 @@ spec("input") { mock_set_expected_calls(ini_gets, CONTROLS * IZ_PLAYERS); mock_set_expected_calls(ini_getl, 2 * IZ_PLAYERS); - IZ_MIDIInputInitialize(&state, "config.ini", 0, NULL); + IZ_MIDIInputInitialize(&state, "config-game.ini", 0, NULL); check( mock_get_expected_calls(ini_gets) == mock_get_actual_calls(ini_gets), @@ -580,7 +580,7 @@ spec("input") { mock_set_expected_calls(ini_puts, CONTROLS * IZ_PLAYERS); mock_set_expected_calls(ini_putl, 2 * IZ_PLAYERS); - IZ_MIDIInputInitialize(&state, "config.ini", 0, NULL); + IZ_MIDIInputInitialize(&state, "config-game.ini", 0, NULL); check( mock_get_expected_calls(ini_puts) == mock_get_actual_calls(ini_puts), @@ -600,7 +600,7 @@ spec("input") { it("opens device handles") { mock_set_expected_calls(Pm_OpenInput, MOCK_OPEN_JOYSTICKS); - IZ_MIDIInputInitialize(&state, "config.ini", 0, NULL); + IZ_MIDIInputInitialize(&state, "config-game.ini", 0, NULL); check( mock_get_expected_calls(Pm_OpenInput) == mock_get_actual_calls(Pm_OpenInput), @@ -626,7 +626,7 @@ spec("input") { mock_set_expected_calls(ini_puts, CONTROLS * IZ_PLAYERS); mock_set_expected_calls(ini_putl, 2 * IZ_PLAYERS); - IZ_MIDIInputSaveConfig("config.ini", &state); + IZ_MIDIInputSaveConfig("config-game.ini", &state); check( mock_get_expected_calls(ini_puts) == mock_get_actual_calls(ini_puts), diff --git a/src/packages/game/net/IZ_net.h b/src/packages/game/net/IZ_net.h index 84e3138..56e3c0f 100644 --- a/src/packages/game/net/IZ_net.h +++ b/src/packages/game/net/IZ_net.h @@ -21,6 +21,7 @@ typedef struct { IZ_WSClientInitializeParams params; void* callback; IZ_Action action[IZ_PLAYERS]; + // TODO add message queue } IZ_NetState; static IZ_NetState IZ_NET_DEFAULT_STATE = { diff --git a/src/packages/game/output/output.test.c b/src/packages/game/output/output.test.c index b660aa6..a767b73 100644 --- a/src/packages/game/output/output.test.c +++ b/src/packages/game/output/output.test.c @@ -21,7 +21,7 @@ spec("output") { it("calls save method") { mock_set_expected_calls(ini_putl, 3); - IZ_VideoSaveConfig(&config, "config.ini"); + IZ_VideoSaveConfig(&config, "config-game.ini"); check( mock_get_expected_calls(ini_putl) == mock_get_actual_calls(ini_putl), diff --git a/src/packages/game/util/IZ_midi.h b/src/packages/game/util/IZ_midi.h index 0ec36e5..ca8e3a6 100644 --- a/src/packages/game/util/IZ_midi.h +++ b/src/packages/game/util/IZ_midi.h @@ -5,7 +5,14 @@ #include #include "../IZ_common.h" +typedef u8 IZ_MIDINote; + +static const u8 IZ_MIDI_NOTE_ON = 0x90u; + +static const u8 IZ_MIDI_NOTE_OFF = 0x80u; + char* IZ_MIDIGetNoteName(u8); + u8 IZ_MIDIGetNoteFromName(char*); #endif diff --git a/src/packages/server/net/IZ_net.h b/src/packages/server/net/IZ_net.h index 76bcd4a..aba10ce 100644 --- a/src/packages/server/net/IZ_net.h +++ b/src/packages/server/net/IZ_net.h @@ -18,7 +18,6 @@ typedef struct { typedef struct { IZ_NetConfig config; IZ_Websocket ws; - // TODO add message queue } IZ_NetState; static IZ_NetState IZ_NET_DEFAULT_STATE = {