Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGreatRambler committed Mar 17, 2024
1 parent 1be3239 commit 0d39878
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 44 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ img/cid
/*.txt
/*.bcd
/*.zip
*.deb
*.deb
*.app
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ifeq ($(PLATFORM),web)

EMS += -s USE_SDL=2 -s USE_ZLIB=1 -s USE_FREETYPE=1 -s USE_LIBPNG=1 -s DISABLE_EXCEPTION_CATCHING=1
CPPFLAGS += -I./third_party/cairo-1.16.0/src -O3 $(EMS)
LDFLAGS += -s CASE_INSENSITIVE_FS=1 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s NO_EXIT_RUNTIME=0 -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_STACK=10000000 -s ASYNCIFY -s FETCH=1 -s FORCE_FILESYSTEM=1 -o bin/index.html --shell-file shell_minimal.html $(PRELOADED_FILES) $(EMS) -L./third_party/cairo-1.16.0/src/.libs -lcairo -L./third_party/pixman-0.40.0/pixman/.libs -lpixman-1
LDFLAGS += -s CASE_INSENSITIVE_FS=1 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s NO_EXIT_RUNTIME=0 -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 -s TOTAL_STACK=10000000 -s ASYNCIFY -s FETCH=1 -s FORCE_FILESYSTEM=1 -s USE_PTHREADS=0 -o bin/index.html --shell-file shell_minimal.html $(PRELOADED_FILES) $(EMS) -L./third_party/cairo-1.16.0/src/.libs -lcairo -L./third_party/pixman-0.42.2/pixman/.libs -lpixman-1
else
CPPFLAGS += $(shell pkg-config --cflags sdl2 glew glfw3 zlib cairo freetype2 libcurl) -Wno-cast-function-type

Expand Down
4 changes: 2 additions & 2 deletions build_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ else
cp -r fonts toost.app/Contents/share
cp -r img toost.app/Contents/share
dylibbundler -od -b -x toost.app/Contents/MacOS/toost -d toost.app/Contents/libs/
zip -9r toost_mac.zip toost.app
rm -rf toost.app
#zip -9r toost_mac.zip toost.app
#rm -rf toost.app
;;
msys*|mingw*)
make BUILD=release -j8
Expand Down
12 changes: 6 additions & 6 deletions prepare_web_deps.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ mkdir third_party
wget -c https://www.cairographics.org/releases/cairo-1.16.0.tar.xz
tar -xvf cairo-1.16.0.tar.xz -C third_party
rm cairo-1.16.0.tar.xz
wget -c https://www.cairographics.org/releases/pixman-0.40.0.tar.gz
tar -xvf pixman-0.40.0.tar.gz -C third_party
rm pixman-0.40.0.tar.gz
wget -c https://www.cairographics.org/releases/pixman-0.42.2.tar.gz
tar -xvf pixman-0.42.2.tar.gz -C third_party
rm pixman-0.42.2.tar.gz

cd third_party/pixman-0.40.0
cd third_party/pixman-0.42.2
CC=emcc AR=emar LD=emcc RANLIB=emranlib PNG_LIBS="-L." ./configure --host=wasm32-unknown-emscripten --disable-gtk --enable-libpng --disable-shared --disable-openmp
export EMCC_CFLAGS="-s USE_PTHREADS=1 -s USE_LIBPNG=1 -s USE_ZLIB=1"
emmake make
cd ../..

cd third_party/cairo-1.16.0
CC=emcc CXX=em++ AR=emar LD=emcc RANLIB=emranlib png_LIBS="-L." FREETYPE_LIBS="-L." pixman_LIBS="-L$PWD/../pixman-0.40.0/pixman/.libs -lpixman-1" ax_cv_c_float_words_bigendian=no ./configure --host=wasm32 --disable-shared --disable-xlib --disable-xcb --disable-qt --disable-quartz --disable-win32 --disable-os2 --disable-beos --disable-drm --disable-gallium --disable-cogl --disable-directfb --disable-vg --disable-script --disable-fc --disable-ps --disable-pdf --disable-svg --disable-tee --disable-xml --disable-gobject --disable-full-testing --disable-interpreter --disable-symbol-lookup
export EMCC_CFLAGS="-s USE_PTHREADS=1 -s USE_LIBPNG=1 -s USE_ZLIB=1 -s USE_FREETYPE=1"
CC=emcc CXX=em++ AR=emar LD=emcc RANLIB=emranlib png_LIBS="-L." FREETYPE_LIBS="-L." pixman_LIBS="-L$PWD/../pixman-0.42.2/pixman/.libs -lpixman-1" ax_cv_c_float_words_bigendian=no ./configure --host=wasm32 --disable-shared --disable-xlib --disable-xcb --disable-qt --disable-quartz --disable-win32 --disable-os2 --disable-beos --disable-drm --disable-gallium --disable-cogl --disable-directfb --disable-vg --disable-script --disable-fc --disable-ps --disable-pdf --disable-svg --disable-tee --disable-xml --disable-gobject --disable-full-testing --disable-interpreter --disable-symbol-lookup
export EMCC_CFLAGS="-s USE_PTHREADS=1 -s USE_LIBPNG=1 -s USE_ZLIB=1 -s USE_FREETYPE=1 -DCAIRO_NO_MUTEX"
emmake make
cd ../..
76 changes: 42 additions & 34 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,29 +140,29 @@ LevelDrawer* DrawMap(LevelParser* level, bool isOverworld, bool log, std::string
}

// 3D平台
//半碰撞
//蘑菇平台
//
//蘑菇跳台
//开关跳台
// 半碰撞
// 蘑菇平台
//
// 蘑菇跳台
// 开关跳台
drawer->DrawItem({ 132 }, false);
drawer->DrawItem({ 16 }, false);
drawer->DrawItem({ 14 }, false);
drawer->DrawItem({ 17 }, false);
drawer->DrawItem({ 113 }, false);
drawer->DrawItem({ 71 }, false);

//箭头 单向板 中间旗 藤蔓
// 箭头 单向板 中间旗 藤蔓

drawer->DrawItem({ 66, 67, 106 }, false);
drawer->DrawItem({ 64 }, false);
drawer->DrawItem({ 90 }, false);

//树 长长吞食花
// 树 长长吞食花
drawer->DrawItem({ 106, 107 }, false);

//地面 传送带 开关 开关砖 P砖 冰锥
//斜坡单独
// 地面 传送带 开关 开关砖 P砖 冰锥
// 斜坡单独
drawer->ReGrdCode();
drawer->DrawGrd();
// DrawSlope()
Expand All @@ -171,60 +171,60 @@ LevelDrawer* DrawMap(LevelParser* level, bool isOverworld, bool log, std::string
drawer->DrawItem({ 53, 94, 99, 100, 79 }, false);
drawer->DrawIce();

//无LINKE
//管道 门 蛇 传送箱
// 无LINKE
// 管道 门 蛇 传送箱
drawer->DrawItem({ 9, 55, 84, 97 }, false);
//机动砖 轨道砖
// 机动砖 轨道砖
drawer->DrawItem({ 85, 119 }, false);
//夹子
// 夹子
drawer->DrawItem({ 105 }, false);
//轨道
// 轨道
drawer->DrawTrack();
//软砖 问号 硬砖 竹轮 云 音符 隐藏 刺 冰块 闪烁砖
// 软砖 问号 硬砖 竹轮 云 音符 隐藏 刺 冰块 闪烁砖
drawer->DrawItem({ 4, 5, 6, 21, 22, 23, 29, 43, 63, 110, 108 }, false);

//跷跷板 熔岩台 升降台
// 跷跷板 熔岩台 升降台
drawer->DrawItem({ 91, 36, 11 }, false);

//狼牙棒
// 狼牙棒
drawer->DrawItem({ 83 }, false);

//齿轮 甜甜圈
// 齿轮 甜甜圈
drawer->DrawItem({ 68, 82 }, false);

//道具
// 道具
drawer->DrawItem({ 0, 1, 2, 3, 8, 10, 12, 13, 15, 18, 19, 20, 25, 28, 30, 31, 32, 33, 34, 35, 39 }, false);
drawer->DrawItem({ 40, 41, 42, 44, 45, 46, 47, 48, 52, 56, 57, 58, 60, 61, 62, 70, 74, 76, 77, 78, 81, 92, 95, 98,
102, 103, 104 },
false);
drawer->DrawItem(
{ 111, 120, 121, 122, 123, 124, 125, 126, 112, 127, 128, 129, 130, 131, 72, 50, 51, 65, 80, 114, 116 }, false);
drawer->DrawItem({ 96, 117, 86 }, false);
//喷枪 火棍
// 喷枪 火棍
drawer->DrawItem({ 24, 54 }, false);

// DrawFireBar(False)
// DrawFire(False)
//夹子
// 夹子
drawer->DrawItem({ 105 }, false);
//轨道
// 轨道
drawer->DrawTrack();
//夹子
// 夹子
drawer->DrawItem({ 105 }, true);
//卷轴相机
// DrawItem("/89/", False)
// 卷轴相机
// DrawItem("/89/", False)

// LINK
//软砖 问号 硬砖 竹轮 云 音符 隐藏 刺 冰块
// 软砖 问号 硬砖 竹轮 云 音符 隐藏 刺 冰块
drawer->DrawItem({ 4, 5, 6, 21, 22, 23, 29, 43, 63 }, true);

//跷跷板 熔岩台 升降台
// 跷跷板 熔岩台 升降台
drawer->DrawItem({ 91, 36, 11 }, true);

//齿轮 甜甜圈
// 齿轮 甜甜圈
drawer->DrawItem({ 68, 82 }, true);

//道具
// 道具
drawer->DrawItem({ 0, 1, 2, 3, 8, 10, 12, 13, 15, 18, 19, 20, 25, 28, 30, 31, 32, 33, 34, 35, 39 }, true);
drawer->DrawItem({ 40, 41, 42, 44, 45, 46, 47, 48, 52, 56, 57, 58, 60, 61, 62, 70, 74, 76, 77, 78, 81, 92, 95, 98,
102, 103, 104 },
Expand All @@ -235,12 +235,12 @@ LevelDrawer* DrawMap(LevelParser* level, bool isOverworld, bool log, std::string

drawer->DrawCID();

//喷枪 火棍
// 喷枪 火棍
drawer->DrawItem({ 24, 54 }, true);
drawer->DrawFireBar();
drawer->DrawFire();

//透明管
// 透明管
drawer->DrawCPipe();

if(!render_objects_over_pipes) {
Expand Down Expand Up @@ -299,12 +299,20 @@ LevelHandler AttemptRender(

if(filesize == 0x5C000) {
if(log) {
puts("File is encrypted");
puts("File is likely encrypted");
}

std::ifstream ifs(choice, std::ios::binary);
std::string input((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>()));
LevelParser::DecryptLevelData(input, content);
} else if(filesize == 0x5BFC0) {
if(log) {
puts("File is likely unencrypted");
}

std::ifstream ifs(choice, std::ios::binary);
std::string input((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>()));
content = input;
} else {
// First, check if compressed
FILE* magicFile = fopen(choice.c_str(), "rb");
Expand All @@ -328,7 +336,7 @@ LevelHandler AttemptRender(

content = gzip::decompress((const char*)data.data(), data.size());
} else {
puts("File is uncompressed or an unknown format");
puts("File is an unknown format");
}
}

Expand Down Expand Up @@ -1101,7 +1109,7 @@ int main(int argc, char** argv) {
SDL_WindowFlags window_flags
= (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_MAXIMIZED);
window = SDL_CreateWindow("Toost | Super Mario Maker 2 Level Viewer", SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED, 640, 360, window_flags);
SDL_WINDOWPOS_CENTERED, 640, 360, window_flags);
gl_context = SDL_GL_CreateContext(window);

if(!gl_context) {
Expand Down

0 comments on commit 0d39878

Please sign in to comment.