Skip to content

Commit

Permalink
WIP: zip support
Browse files Browse the repository at this point in the history
  • Loading branch information
carstene1ns committed Sep 25, 2024
1 parent 47c3fc5 commit 369a351
Show file tree
Hide file tree
Showing 18 changed files with 3,253 additions and 109 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ set_property(SOURCE src/main.cpp PROPERTY COMPILE_DEFINITIONS
OJ_URL="${PROJECT_HOMEPAGE_URL}"; OJ_BUGREPORT="${OJ_BUGREPORT}")

target_link_libraries(OpenJazz
argparse psmplug stb lodepng miniz
argparse psmplug stb lodepng mg miniz
${OJ_LIBS_SCALE} ${OJ_LIBS_SDL} ${OJ_LIBS_NET} ${OJ_LIBS_HOST})

# platform stuff
Expand Down
18 changes: 17 additions & 1 deletion ext/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ target_include_directories(stb INTERFACE stb)
# miniz

add_library(miniz STATIC miniz/miniz.h miniz/miniz.cpp)
target_compile_definitions(miniz INTERFACE MINIZ_NO_ARCHIVE_APIS)
target_compile_definitions(miniz INTERFACE MINIZ_NO_ZLIB_COMPATIBLE_NAMES)
#target_compile_definitions(miniz PRIVATE _LARGEFILE64_SOURCE)
target_include_directories(miniz INTERFACE miniz)

Expand All @@ -51,6 +51,22 @@ target_compile_definitions(lodepng INTERFACE
target_include_directories(lodepng INTERFACE lodepng)
target_link_libraries(lodepng PRIVATE miniz)

# mg

add_library(mg STATIC
mg/assetsys.cpp
mg/assetsys.h
mg/strpool.cpp
mg/strpool.h
)
#target_compile_definitions(mg INTERFACE
# ASSETSYS_U64 uint64_t
# STRPOOL_U32 uint32_t
# STRPOOL_U64 uint64_t
#)
target_include_directories(mg INTERFACE mg)
target_link_libraries(mg PRIVATE miniz)

if(ANDROID)
include(FetchContent)

Expand Down
2 changes: 2 additions & 0 deletions ext/mg/assetsys.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define ASSETSYS_IMPLEMENTATION
#include "assetsys.h"
1,680 changes: 1,680 additions & 0 deletions ext/mg/assetsys.h

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions ext/mg/strpool.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define STRPOOL_IMPLEMENTATION
#include "strpool.h"
1,313 changes: 1,313 additions & 0 deletions ext/mg/strpool.h

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions ext/miniz/miniz.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,12 @@
*/
#pragma once

// OpenJazz modification
#ifndef MINIZ_NO_ARCHIVE_APIS
#define MINIZ_NO_ARCHIVE_APIS
// OpenJazz Modification
#ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES
# define MINIZ_NO_ZLIB_COMPATIBLE_NAMES
#endif
#if WORDS_BIGENDIAN==1
# define MINIZ_LITTLE_ENDIAN 0
#endif
#if defined(__3DS__) || defined(__wii__)
# define OJ_NO_LARGE_FILE
Expand Down
2 changes: 1 addition & 1 deletion src/game/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class ServerGame : public Game {
unsigned char recvBuffers[MAX_CLIENTS][BUFFER_LENGTH]; ///< Array of buffers containing data received from clients
int received[MAX_CLIENTS]; ///< Array containing the amount of data received from each client
unsigned char *levelData; ///< Contents of the current level file
int levelSize; ///< Size of the current level file
size_t levelSize; ///< Size of the current level file
int sock; ///< Server socket

public:
Expand Down
Loading

0 comments on commit 369a351

Please sign in to comment.