From fd6301a84082dd33ac85ee53c15c982edafe4ef7 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Fri, 9 Jun 2023 23:25:21 +1000 Subject: [PATCH] Update buildbot.sh with more recent changes, and minorly tidy up readme --- doc/overriding-defaults.md | 44 +++++++++++++++++++++----------------- misc/buildbot.sh | 24 +++++++++++++++------ readme.md | 14 ++++++------ src/GameVersion.c | 4 ++-- 4 files changed, 50 insertions(+), 36 deletions(-) diff --git a/doc/overriding-defaults.md b/doc/overriding-defaults.md index 735240ab8..b50808d21 100644 --- a/doc/overriding-defaults.md +++ b/doc/overriding-defaults.md @@ -1,37 +1,41 @@ +#### Note: By default, ClassiCube automatically selects the recommended backends for the platform.
It is recommended that you do *NOT* change the backends unless you know exactly what you are doing. + TODO finish this -TODO introduction (explaining platform specific modules) +TODO introduction (explaining platform specific modules, and how classicube has to integrate with one of them) Two ways 1) Changing the defines in `Core.h` -2) Adding `-DCC_BUILD_MANUAL` to compilation flags and manually defining module backend +2) Adding `-DCC_BUILD_MANUAL` to compilation flags and manually defining module backends Graphics backends -CC_BUILD_GL -CC_BUILD_GLMODERN -CC_BUILD_D3D9 -CC_BUILD_3D11 - -CC_BUILD_GL11 -CC_BUILD_GLES +* CC_BUILD_D3D9 - Direct3D 9 +* CC_BUILD_D3D11 - Direct3D 11 +* CC_BUILD_GL - OpenGL +* CC_BUILD_GLMODERN - (must also have CC_BUILD_GL defined) +* CC_BUILD_GLES (must also have CC_BUILD_GL defined) +* CC_BUILD_GL11 - (must also have CC_BUILD_GL defined) OpenGL context backends -CC_BUILD_EGL -CC_BUILD_WGL +* CC_BUILD_EGL +* CC_BUILD_WGL HTTP backends -CC_BUILD_WININET -CC_BUILD_CURL -CC_BUILD_CFNETWORK -CC_BUILD_HTTPCLIENT +* CC_BUILD_CURL +* CC_BUILD_HTTPCLIENT - custom HTTP client +* CC_BUILD_WININET +* CC_BUILD_CFNETWORK + +SSL backends +* CC_BUILD_SCHANNEL Window backends -CC_BUILD_WINGUI -CC_BUILD_X11 -CC_BUILD_SDL +* CC_BUILD_SDL +* CC_BUILD_X11 +* CC_BUILD_WINGUI Platform backends -CC_BUILD_WIN -CC_BUILD_POSIX +* CC_BUILD_POSIX +* CC_BUILD_WIN TODO fill in rest \ No newline at end of file diff --git a/misc/buildbot.sh b/misc/buildbot.sh index 92087f35b..5f8732591 100644 --- a/misc/buildbot.sh +++ b/misc/buildbot.sh @@ -34,23 +34,29 @@ WIN64_FLAGS="-mwindows -nostartfiles -Wl,-emain_real -DCC_NOMAIN" build_win32() { echo "Building win32.." cp $ROOT_DIR/misc/CCicon_32.res $ROOT_DIR/src/CCicon_32.res - rm cc-w32-d3d.exe cc-w32-ogl.exe $WIN32_CC *.c $ALL_FLAGS $WIN32_FLAGS -o cc-w32-d3d.exe CCicon_32.res -DCC_COMMIT_SHA=\"$LATEST\" -lwinmm -limagehlp if [ $? -ne 0 ]; then echo "Failed to compile Windows 32 bit" >> "$ERRS_FILE"; fi $WIN32_CC *.c $ALL_FLAGS $WIN32_FLAGS -o cc-w32-ogl.exe CCicon_32.res -DCC_COMMIT_SHA=\"$LATEST\" -DCC_BUILD_MANUAL -DCC_BUILD_WIN -DCC_BUILD_GL -DCC_BUILD_WINGUI -DCC_BUILD_WGL -DCC_BUILD_WINMM -DCC_BUILD_WININET -lwinmm -limagehlp -lopengl32 if [ $? -ne 0 ]; then echo "Failed to compile Windows 32 bit (OpenGL)" >> "$ERRS_FILE"; fi + $WIN32_CC *.c $ALL_FLAGS $WIN32_FLAGS -o cc-w32-d3d11.exe CCicon_32.res -DCC_COMMIT_SHA=\"$LATEST\" -DCC_BUILD_MANUAL -DCC_BUILD_WIN -DCC_BUILD_D3D11 -DCC_BUILD_WINGUI -DCC_BUILD_WGL -DCC_BUILD_WINMM -DCC_BUILD_WININET -lwinmm -limagehlp + if [ $? -ne 0 ]; then echo "Failed to compile Windows 32 bit (Direct3D11)" >> "$ERRS_FILE"; fi + + # mingw defaults to i686, but some really old CPUs only support i586 + $WIN32_CC *.c $ALL_FLAGS $WIN32_FLAGS -march=i586 -o cc-w9x-ogl.exe CCicon_32.res -DCC_COMMIT_SHA=\"$LATEST\" -DCC_BUILD_MANUAL -DCC_BUILD_WIN -DCC_BUILD_GL -DCC_BUILD_WINGUI -DCC_BUILD_WGL -DCC_BUILD_WINMM -DCC_BUILD_WININET -lwinmm -limagehlp -lopengl32 + if [ $? -ne 0 ]; then echo "Failed to compile Windows 9x (OpenGL)" >> "$ERRS_FILE"; fi } build_win64() { echo "Building win64.." cp $ROOT_DIR/misc/CCicon_64.res $ROOT_DIR/src/CCicon_64.res - rm cc-w64-d3d.exe cc-w64-ogl.exe $WIN64_CC *.c $ALL_FLAGS $WIN64_FLAGS -o cc-w64-d3d.exe CCicon_64.res -DCC_COMMIT_SHA=\"$LATEST\" -lwinmm -limagehlp if [ $? -ne 0 ]; then echo "Failed to compile Windows 64 bit" >> "$ERRS_FILE"; fi $WIN64_CC *.c $ALL_FLAGS $WIN64_FLAGS -o cc-w64-ogl.exe CCicon_64.res -DCC_COMMIT_SHA=\"$LATEST\" -DCC_BUILD_MANUAL -DCC_BUILD_WIN -DCC_BUILD_GL -DCC_BUILD_WINGUI -DCC_BUILD_WGL -DCC_BUILD_WINMM -DCC_BUILD_WININET -lwinmm -limagehlp -lopengl32 if [ $? -ne 0 ]; then echo "Failed to compile Windows 64 bit (OpenGL)" >> "$ERRS_FILE"; fi + $WIN64_CC *.c $ALL_FLAGS $WIN64_FLAGS -o cc-w64-d3d11.exe CCicon_64.res -DCC_COMMIT_SHA=\"$LATEST\" -DCC_BUILD_MANUAL -DCC_BUILD_WIN -DCC_BUILD_D3D11 -DCC_BUILD_WINGUI -DCC_BUILD_WGL -DCC_BUILD_WINMM -DCC_BUILD_WININET -lwinmm -limagehlp + if [ $? -ne 0 ]; then echo "Failed to compile Windows 64 bit (Direct3D11)" >> "$ERRS_FILE"; fi } # ----------------------------- compile linux @@ -106,7 +112,7 @@ WEB_CC="/home/buildbot/emsdk/emscripten/1.38.31/emcc" build_web() { echo "Building web.." rm cc.js - $WEB_CC *.c -O1 -o cc.js --js-library interop_web.js -s WASM=0 -s LEGACY_VM_SUPPORT=1 -s ALLOW_MEMORY_GROWTH=1 -s ABORTING_MALLOC=0 -s ENVIRONMENT=web -w + $WEB_CC *.c -O1 -o cc.js --js-library interop_web.js -s WASM=0 -s LEGACY_VM_SUPPORT=1 -s ALLOW_MEMORY_GROWTH=1 -s ABORTING_MALLOC=0 -s ENVIRONMENT=web if [ $? -ne 0 ]; then echo "Failed to compile Webclient" >> "$ERRS_FILE"; fi # fix mouse wheel scrolling page not being properly prevented # "[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive." @@ -116,8 +122,6 @@ build_web() { # ----------------------------- compile raspberry pi # I cloned https://github.com/raspberrypi/tools to get prebuilt cross compilers # Then I copied across various files/folders from /usr/include and /usr/lib from a real Raspberry pi as needed -# I cloned https://github.com/raspberrypi/tools to get prebuilt cross compilers -# Then I copied across various files/folders from /usr/include and /usr/lib from a real Raspberry pi as needed RPI32_CC=~/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc-4.8.3 RPI_FLAGS="-fvisibility=hidden -rdynamic -DCC_BUILD_ICON -DCC_BUILD_RPI" # I cloned from https://github.com/abhiTronix/raspberry-pi-cross-compilers @@ -198,17 +202,23 @@ build_android() { # jarsigner -verbose # create aligned .apk file $TOOLS_ROOT/zipalign -f 4 obj/cc-signed.apk $ROOT_DIR/src/cc.apk + # restore to normal directory now that finished + cd $ROOT_DIR/src/ } # ----------------------------- compile ios IOS_CC="ios-cc" IOS_LIBS="-framework OpenGLES -framework CoreGraphics -framework IOKit -framework CoreFoundation -framework Foundation -framework UIKit -framework QuartzCore -framework CFNetwork -lobjc" -IOS_FLAGS="-s -O1 -fvisibility=hidden -rdynamic -funwind-tables" +IOS_FLAGS="-s -O1 -fvisibility=hidden -rdynamic -funwind-tables -arch armv7 -arch arm64" build_ios() { echo "Building ios.." +# IPHONEOS_DEPLOYMENT_TARGET=7.0 $IOS_CC *.c interop_ios.m $IOS_FLAGS $IOS_LIBS -o cc-ios $IOS_CC *.c interop_ios.m $IOS_FLAGS $IOS_LIBS -o cc-ios - mkdir -p Payload/ClassiCube.app + if [ $? -ne 0 ]; then echo "Failed to compile iOS" >> "$ERRS_FILE"; fi + + mkdir Payload + mkdir Payload/ClassiCube.app cp cc-ios Payload/ClassiCube.app/ClassiCube # https://askubuntu.com/questions/681949/plutil-equivalent-in-ubuntu plistutil -i $ROOT_DIR/ios/Info.plist -o Payload/ClassiCube.app/Info.plist -f bin diff --git a/readme.md b/readme.md index 55bfe763c..8a7e36960 100644 --- a/readme.md +++ b/readme.md @@ -3,13 +3,13 @@ ClassiCube is a custom Minecraft Classic compatible client written in C that wor ![screenshot_n](http://i.imgur.com/FCiwl27.png) -You can download the game [from here](https://www.classicube.net/download/) and the very latest builds [from here](https://www.classicube.net/nightlies/). +You can download ClassiCube [from here](https://www.classicube.net/download/) and the very latest builds [from here](https://www.classicube.net/nightlies/). ### We need your help ClassiCube strives to support providing an experience identical to the original Minecraft Classic by **strictly following a [clean room](https://en.wikipedia.org/wiki/Clean_room_design) reverse engineering approach**. -If you're interested in documenting or verifying the behaviour of the original Minecraft Classic, please get in contact with me. (UnknownShadow200#2728 on Discord) +If you're interested in documenting or verifying the behaviour of the original Minecraft Classic, please get in contact with me. (`unknownshadow200` on Discord) ## Information @@ -64,27 +64,27 @@ If you get a ```The Windows SDK version 5.1 was not found``` compilation error, ##### Using Visual Studio (command line) 1. Use 'Developer Tools for Visual Studio' from Start Menu -2. Navigate to directory with game's source code +2. Navigate to the directory with ClassiCube's source code 3. Enter `cl.exe *.c /link user32.lib gdi32.lib winmm.lib dbghelp.lib shell32.lib comdlg32.lib /out:ClassiCube.exe` ##### Using MinGW-w64 I am assuming you used the installer from https://sourceforge.net/projects/mingw-w64/ 1. Install MinGW-W64 2. Use either *Run Terminal* from Start Menu or run *mingw-w64.bat* in the installation folder -3. Navigate to directory with game's source code +2. Navigate to the directory with ClassiCube's source code 4. Enter `gcc *.c -o ClassiCube.exe -mwindows -lwinmm -limagehlp` ##### Using MinGW I am assuming you used the installer from https://osdn.net/projects/mingw/ 1. Install MinGW. You need mingw32-base-bin and msys-base-bin packages. 2. Run *msys.bat* in the *C:\MinGW\msys\1.0* folder. -3. Navigate to directory with game's source code +2. Navigate to the directory with ClassiCube's source code 4. Enter `gcc *.c -o ClassiCube.exe -mwindows -lwinmm -limagehlp` ##### Using TCC I am assuming you used `tcc-0.9.27-win64-bin.zip` from https://bellard.org/tcc/ 1. Extract the .zip file -2. In `ExtMath.C`, change `fabsf` to `fabs` and `sqrtf` to `sqrtf` +2. In `ExtMath.c`, change `fabsf` to `fabs` and `sqrtf` to `sqrtf` 3. In TCC's `include/math.h`, remove the inline definition for `fabs` at around line 217 4. In TCC's `lib/kernel32.def`, add missing `RtlCaptureContext` 5. Add missing include files from `winapi-full-for-0.9.27.zip` as required @@ -211,7 +211,7 @@ You'll have to write the necessary code. You should read portability.md in doc f Functions and variables in .h files are mostly documented. -Further information (e.g. style) for the game's source code can be found in the doc and misc folders. +Further information (e.g. style) for ClassiCube's source code can be found in the doc and misc folders. #### Known compilation errors diff --git a/src/GameVersion.c b/src/GameVersion.c index c33b8001d..77ca52a5c 100644 --- a/src/GameVersion.c +++ b/src/GameVersion.c @@ -67,10 +67,10 @@ static const struct GameVersion version_0017 = { void GameVersion_Load(void) { int version = Options_GetInt(OPT_GAME_VERSION, VERSION_0017, VERSION_0030, VERSION_0030); - const struct GameVersion* ver = NULL; + const struct GameVersion* ver = &version_cpe; if (Game_UseCPE) { - ver = &version_cpe; + /* defaults to CPE already */ } else if (version == VERSION_0030) { ver = &version_0030; } else if (version == VERSION_0023) {