From 227617b540db54b30f9fb08e63866c4dabbf6dfc Mon Sep 17 00:00:00 2001 From: Andrew D'Addesio Date: Wed, 17 Oct 2012 03:21:00 -0500 Subject: [PATCH] Moved to git Assembla's decision to remove Trac incited us to ditch them entirely. Further, the repository no longer includes binaries or libraries; these can be downloaded from niotso.org/pub/ and updated with the included update-libraries script. --- .gitignore | 1 + CMakeLists.txt | 20 ++++ Client/CMakeLists.txt | 3 +- Client/COPYING | 2 +- Client/TODO | 11 ++- Compiling instructions.txt | 25 ----- Documentation.txt | 7 -- Libraries/CMakeLists.txt | 2 - Libraries/FileHandler/Audio.cpp | 2 +- Libraries/FileHandler/CMakeLists.txt | 7 +- Libraries/FileHandler/Image.cpp | 4 +- Libraries/FileHandler/Text.cpp | 17 ++++ Libraries/libgldemo/CMakeLists.txt | 24 ++--- Libraries/libgldemo/wgl.c | 10 +- Libraries/libvitaboy/CMakeLists.txt | 4 +- Libraries/libvitaboy/Renderer.cpp | 18 ++-- README.md | 35 +++++++ Tools/FARDive/CMakeLists.txt | 2 +- .../TSOEdithEditor/TSOEdithEditor.cpp | 52 ++++++++++ .../TSOEdithEditor/TSOEdithEditor.hpp | 68 +++++++++++++ .../TSOEdithEditor/compile.bat | 1 + .../TSOSimulatorClient/TSOSimulatorClient.cpp | 16 ++-- .../TSOSimulatorClient/TSOSimulatorClient.hpp | 12 ++- Tools/iff2html/CMakeLists.txt | 2 +- Tools/iff2html/image.c | 2 +- Tools/iff2html/opngreduc.h | 2 +- Tools/inputtest/Readme.txt | 1 + Tools/inputtest/compile.bat | 1 + Tools/inputtest/inputtest.cpp | 96 +++++++++++++++++++ Tools/tsoscan/CMakeLists.txt | 2 +- update-libraries.bat | 1 + update-libraries.mk | 12 +++ update-libraries.sh | 1 + 33 files changed, 368 insertions(+), 95 deletions(-) create mode 100644 .gitignore delete mode 100644 Compiling instructions.txt delete mode 100644 Documentation.txt create mode 100644 Libraries/FileHandler/Text.cpp create mode 100644 README.md create mode 100644 Tools/TSOSimulatorClient/TSOEdithEditor/TSOEdithEditor.cpp create mode 100644 Tools/TSOSimulatorClient/TSOEdithEditor/TSOEdithEditor.hpp create mode 100644 Tools/TSOSimulatorClient/TSOEdithEditor/compile.bat create mode 100644 Tools/inputtest/Readme.txt create mode 100644 Tools/inputtest/compile.bat create mode 100644 Tools/inputtest/inputtest.cpp create mode 100644 update-libraries.bat create mode 100644 update-libraries.mk create mode 100644 update-libraries.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e029f81 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +$(find -iname "_build/") $(find -iname "_deps/") $(find -iname "_dist/") $(find -iname "*.o") $(find -iname "*.lo") $(find -iname "*.slo") $(find -iname "*.res") $(find -iname "*.obj") $(find -iname "*.pch") $(find -iname "*.gch") $(find -iname "*.a") $(find -iname "*.la") $(find -iname "*.lai") $(find -iname "*.lib") $(find -iname "*.dll") $(find -iname "*.so") $(find -iname "*.so.*") $(find -iname "*.dylib") $(find -iname "*.exe") $(find -iname "*.app") $(find -iname "*.gcno") $(find -iname "*.gcda") $(find -iname "*.gcov") $(find -iname "Makefile.in") $(find -iname "autom4te.cache") $(find -iname "*.am") $(find -iname "*.ac") $(find -iname "*.m4") $(find -iname "*.po") $(find -iname "*.gmo") $(find -iname "*.at") $(find -iname "*.texi") $(find -iname "*.pc") $(find -iname "compile") $(find -iname "configure") $(find -iname "depcomp") $(find -iname "install-sh") $(find -iname "missing") $(find -iname "CMakeCache.txt") $(find -iname "CMakeFiles") $(find -iname "cmake_install.cmake") $(find -iname "install_manifest.txt") $(find -iname "*.sln.*") $(find -iname "*.ncb") $(find -iname "*.user") $(find -iname "*.ilk") $(find -iname "*.pdb") $(find -iname "*.idb") $(find -iname "*.pgc") $(find -iname "*.pgd") $(find -iname "*.rsp") $(find -iname "*.sbr") $(find -iname "*.tlb") $(find -iname "*.tli") $(find -iname "*.tlh") $(find -iname "*.aps") $(find -iname "*.opensdf") $(find -iname "*.sdf") $(find -iname "*.psess") $(find -iname "*.vsp") $(find -iname "*.vspx") $(find -iname "*.vspscc") $(find -iname "*.vssscc") $(find -iname "*.Resources") $(find -iname "*.Cache") $(find -iname "*.gpState") $(find -iname "_ReSharper*") $(find -iname "*.ncrunch*") $(find -iname ".*crunch*.local.xml") $(find -iname "csx") $(find -iname "*.build.csdef") $(find -iname "*.dbmdl") $(find -iname ".builds") $(find -iname "*.scc") $(find -iname "ipch/") $(find -iname "AppPackages/") $(find -iname "_UpgradeReport_Files/") $(find -iname "BuildLog.htm") $(find -iname "UpgradeLog*.XML") $(find -iname "*.pro.user") $(find -iname "*.pro.user.*") $(find -iname "moc_*.cpp") $(find -iname "qrc_*.cpp") $(find -iname "*.dmg") $(find -iname "*.xpi") $(find -iname "*.gem") $(find -iname "*.egg") $(find -iname "*.deb") $(find -iname "*.rpm") $(find -iname "*.apk") $(find -iname "*.ap_") $(find -iname "*.db") $(find -iname "Desktop.ini") $(find -iname "$RECYCLE.BIN/") $(find -iname ".DS_Store") $(find -iname ".AppleDouble") $(find -iname ".LSOverride") $(find -iname "Icon") $(find -iname ".Spotlight-V100") $(find -iname ".Trashes") $(find -iname ".~*") \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index e3f7bd8..726e9b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,6 +110,26 @@ endif() set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/_dist/${DIST_NAME}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/_dist/${DIST_NAME}") +if(WIN32) + set(FREETYPE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/_deps/freetype/include ${CMAKE_SOURCE_DIR}/_deps/freetype/include/freetype/config) + set(LIBJPEGTURBO_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/_deps/libjpeg-turbo) + set(LIBMPG123_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/_deps/libmpg123) + set(LIBPNG_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/_deps/libpng) + set(LIBPQ_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/_deps/libpq ${CMAKE_SOURCE_DIR}/_deps/libpq/include ${CMAKE_SOURCE_DIR}/_deps/libpq/include/port/win32 ${CMAKE_SOURCE_DIR}/_deps/libpq/include/port) + set(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/_deps/zlib) + + add_subdirectory(_deps/freetype) + add_subdirectory(_deps/libjpeg-turbo) + add_subdirectory(_deps/libmpg123) + add_subdirectory(_deps/libpng) + add_subdirectory(_deps/libpq) + add_subdirectory(_deps/zlib) +endif() + +set(FILEHANDLER_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/Libraries/FileHandler) +set(LIBGLDEMO_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/Libraries/libgldemo) +set(LIBVITABOY_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/Libraries/libvitaboy) + add_subdirectory(Client) add_subdirectory(Libraries) add_subdirectory(Server) diff --git a/Client/CMakeLists.txt b/Client/CMakeLists.txt index cb659ad..178804d 100644 --- a/Client/CMakeLists.txt +++ b/Client/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 2.6) project(NiotsoClient) -include_directories(${CMAKE_SOURCE_DIR}/Libraries/FileHandler) -include_directories(${CMAKE_SOURCE_DIR}/Libraries/freetype/include) +include_directories(${FILEHANDLER_INCLUDE_DIR} ${FREETYPE_INCLUDE_DIR}) if(WIN32) set(NIOTSOCLIENT_SOURCES diff --git a/Client/COPYING b/Client/COPYING index 7d3d83f..acdc1dc 100644 --- a/Client/COPYING +++ b/Client/COPYING @@ -15,7 +15,7 @@ These restrictions are not enforced by us, but may potentially be used by EA in attempt to take down your game. If you have any questions, you may visit - + --- diff --git a/Client/TODO b/Client/TODO index bc030d2..8f37171 100644 --- a/Client/TODO +++ b/Client/TODO @@ -11,8 +11,11 @@ Development Phase: Planning Technical Preview 1 Schedule: (Not very subject to change) - 1. Implement cst and uis parsers [40%] + 1. Implement cst, uis, ini, and xml parsers with support for UTF-8 [20%] 2. Replicate functionality up until the login dialog [90%] - 3. Implement the OpenGL-based windowing system - 4. Replicate character selection and creation features and the city selection dialog - 5. Implement the code needed to allow the game to read all necessary files from the TSOClient folder \ No newline at end of file + 3. Implement the audio engine + 4. Implement the OpenGL-based windowing system + 5. Replicate character selection and creation features and the city selection dialog + 6. Implement debug logging and support for configuration files + 7. Implement the code needed to allow the game to read all necessary files from the TSOClient folder + 8. Port the client to Linux \ No newline at end of file diff --git a/Compiling instructions.txt b/Compiling instructions.txt deleted file mode 100644 index 1f27bc3..0000000 --- a/Compiling instructions.txt +++ /dev/null @@ -1,25 +0,0 @@ -All you need installed to compile Niotso for Windows, Linux, or Mac is cmake 2.6 or newer, a compatible compiler (such as GCC 4.6 or newer), and NASM 2.0 or newer for libjpeg-turbo and libmpg123. - -cd into the _build directory and run - $ cmake -G "" .. - -The list of generators can be found with cmake --help. - -//-- Makefile - -Run "make" to compile every package. -j # will greatly speed up the compile time for processors with # cores. -Run "make install" after compiling to install Niotso to your game directory; please specify it first in the Makefile. - -Run "make objclean" to delete all object files created during compilation. -Run "make clean" to delete all object files and executable files created during compilation. -Run "make distclean" to delete all files of any kind created during compilation. (Includes profile-collection files.) -Run "make uninstall" to delete Niotso from your game directory. -Run "make uninstall_all" to delete Niotso from your game directory as well as all Niotso.ini files created by Niotso. - -Run "make " to compile only a specific package. -For a list of packages, run "make help". -Note that packages must and will compile any other packages required as a dependency. - -//-- Code::Blocks, Visual Studio, XCode - -Open the solution or project file; you may select between a Release, Debug, Release64, and Debug64 build configuration. \ No newline at end of file diff --git a/Documentation.txt b/Documentation.txt deleted file mode 100644 index 6c6bc4d..0000000 --- a/Documentation.txt +++ /dev/null @@ -1,7 +0,0 @@ -All documentation is centralized online rather than scattered around the codebase. - -For documentation regarding the packages in the repository, that will be at the Trac: -http://trac-hg.assembla.com/niotso - -For all other documentation (including format specifications), that will be at Niotso Wiki: -http://wiki.niotso.org \ No newline at end of file diff --git a/Libraries/CMakeLists.txt b/Libraries/CMakeLists.txt index a1e6136..9f2cf98 100644 --- a/Libraries/CMakeLists.txt +++ b/Libraries/CMakeLists.txt @@ -7,7 +7,5 @@ else() endif() add_subdirectory(FileHandler) -add_subdirectory(freetype) add_subdirectory(libgldemo) -add_subdirectory(libpq) add_subdirectory(libvitaboy) diff --git a/Libraries/FileHandler/Audio.cpp b/Libraries/FileHandler/Audio.cpp index 45f72be..234a164 100644 --- a/Libraries/FileHandler/Audio.cpp +++ b/Libraries/FileHandler/Audio.cpp @@ -17,10 +17,10 @@ */ #include "FileHandler.hpp" +#include #include "wav/read_wav.h" #include "xa/read_xa.h" #include "utk/read_utk.h" -#include "libmpg123/mpg123.h" namespace File { diff --git a/Libraries/FileHandler/CMakeLists.txt b/Libraries/FileHandler/CMakeLists.txt index efdd317..8a708bf 100644 --- a/Libraries/FileHandler/CMakeLists.txt +++ b/Libraries/FileHandler/CMakeLists.txt @@ -11,13 +11,8 @@ endif() add_subdirectory(far) add_subdirectory(iff) -add_subdirectory(libexpat) -add_subdirectory(libjpeg-turbo) -add_subdirectory(libmpg123) -add_subdirectory(libpng) add_subdirectory(utk) add_subdirectory(xa) -add_subdirectory(zlib) set(FILEHANDLER_SOURCES Audio.cpp @@ -33,7 +28,7 @@ if(WIN32) set(FILEHANDLER_SOURCES ${FILEHANDLER_SOURCES} resource.rc) endif() -include_directories(${CMAKE_SOURCE_DIR}/Libraries/FileHandler) +include_directories(${FILEHANDLER_INCLUDE_DIR} ${LIBMPG123_INCLUDE_DIR} ${LIBJPEGTURBO_INCLUDE_DIR} ${LIBPNG_INCLUDE_DIR}) #### Static library (uncomment to build) #add_library(FileHandler_static STATIC ${FILEHANDLER_SOURCES}) diff --git a/Libraries/FileHandler/Image.cpp b/Libraries/FileHandler/Image.cpp index accbf56..762443c 100644 --- a/Libraries/FileHandler/Image.cpp +++ b/Libraries/FileHandler/Image.cpp @@ -18,9 +18,9 @@ #include "FileHandler.hpp" #include //Used by libpng +#include +#include #include "bmp/read_bmp.h" -#include "libjpeg-turbo/jpeglib.h" -#include "libpng/png.h" namespace File { diff --git a/Libraries/FileHandler/Text.cpp b/Libraries/FileHandler/Text.cpp new file mode 100644 index 0000000..49dcd91 --- /dev/null +++ b/Libraries/FileHandler/Text.cpp @@ -0,0 +1,17 @@ +/* + FileHandler - General-purpose file handling library for Niotso + Text.cpp - Copyright (c) 2012 Niotso Project + Author(s): Fatbag + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ \ No newline at end of file diff --git a/Libraries/libgldemo/CMakeLists.txt b/Libraries/libgldemo/CMakeLists.txt index f837084..0017c3e 100644 --- a/Libraries/libgldemo/CMakeLists.txt +++ b/Libraries/libgldemo/CMakeLists.txt @@ -1,14 +1,14 @@ -cmake_minimum_required(VERSION 2.6) -project(libgldemo) - -if(WIN32) - set(LIBGLDEMO_SOURCES wgl.c) -else() +cmake_minimum_required(VERSION 2.6) +project(libgldemo) + +if(WIN32) + set(LIBGLDEMO_SOURCES wgl.c) +else() set(LIBGLDEMO_SOURCES glx.c) - add_definitions(-D_POSIX_C_SOURCE=200112) -endif() - -add_library(libgldemo_static STATIC ${LIBGLDEMO_SOURCES}) -set_target_properties(libgldemo_static PROPERTIES - OUTPUT_NAME "gldemo" + add_definitions(-D_POSIX_C_SOURCE=200112) +endif() + +add_library(libgldemo_static STATIC ${LIBGLDEMO_SOURCES}) +set_target_properties(libgldemo_static PROPERTIES + OUTPUT_NAME "gldemo" CLEAN_DIRECT_OUTPUT 1) diff --git a/Libraries/libgldemo/wgl.c b/Libraries/libgldemo/wgl.c index 67926cc..e1408d2 100644 --- a/Libraries/libgldemo/wgl.c +++ b/Libraries/libgldemo/wgl.c @@ -49,8 +49,6 @@ static void KillGLWindow() DestroyWindow(hWnd); hWnd = NULL; } - - UnregisterClass("OpenGL", hInst); } static int CreateGLWindow(const char *__restrict title, uint16_t width, uint16_t height) @@ -71,7 +69,6 @@ static int CreateGLWindow(const char *__restrict title, uint16_t width, uint16_t 0, /* Reserved */ 0, 0, 0 /* Masks */ }; - DEVMODE dm; DWORD dwStyle, dwExStyle; RECT WindowRect; int PixelFormat; @@ -79,10 +76,11 @@ static int CreateGLWindow(const char *__restrict title, uint16_t width, uint16_t int (WINAPI *wglGetSwapIntervalEXT)(void); if(fullscreen){ - width = dm.dmPelsWidth; - height = dm.dmPelsHeight; dwExStyle = WS_EX_APPWINDOW | WS_EX_TOPMOST; dwStyle = WS_POPUP; + + width = ResWidth; + height = ResHeight; ShowCursor(0); }else{ dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; @@ -227,7 +225,6 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi wc.hInstance = hInst = hInstance; wc.hIcon = (HICON) LoadImage(NULL, IDI_WINLOGO, IMAGE_ICON, 0, 0, LR_SHARED); wc.hCursor = (HCURSOR) LoadImage(NULL, IDC_ARROW, IMAGE_CURSOR, 0, 0, LR_SHARED | LR_DEFAULTSIZE); - hInstance = GetModuleHandle(NULL); EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm); ResWidth = dm.dmPelsWidth; ResHeight = dm.dmPelsHeight; @@ -259,6 +256,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi if(msg.message == WM_QUIT){ KillGLWindow(); + UnregisterClass("OpenGL", hInstance); return (!Demo.Shutdown || Demo.Shutdown()) ? 0 : -1; } } diff --git a/Libraries/libvitaboy/CMakeLists.txt b/Libraries/libvitaboy/CMakeLists.txt index 731d530..5a0becb 100644 --- a/Libraries/libvitaboy/CMakeLists.txt +++ b/Libraries/libvitaboy/CMakeLists.txt @@ -23,8 +23,8 @@ else() add_definitions(-Dstricmp=strcasecmp) endif() -include_directories(${CMAKE_SOURCE_DIR}/Libraries/libgldemo) -include_directories(${CMAKE_SOURCE_DIR}/Libraries/FileHandler) +include_directories(${LIBGLDEMO_INCLUDE_DIR}) +include_directories(${FILEHANDLER_INCLUDE_DIR}) #### Static library (uncomment to build) #add_library(libvitaboy_static STATIC ${LIBVITABOY_SOURCES}) diff --git a/Libraries/libvitaboy/Renderer.cpp b/Libraries/libvitaboy/Renderer.cpp index 0d8fed8..0982ba4 100644 --- a/Libraries/libvitaboy/Renderer.cpp +++ b/Libraries/libvitaboy/Renderer.cpp @@ -42,6 +42,7 @@ i,j,k,l: Translate the sim around the screen z,x: Rotate the sim like a clock a,s: Zoom in, out + q: Toggle skeleton n: Animate the character F11: Enter/leave fullscreen */ @@ -81,6 +82,8 @@ static float AnimationTime = 0; static bool ShowMesh = true; static bool ShowSkeleton = true; +static bool PressedQ = false; + static void DisplayFileError(const char * Filename){ const char * Message; switch(File::Error){ @@ -366,13 +369,14 @@ static int DrawScene(float TimeDelta, uint8_t keys[256]) if(keys[KEY_DOWN]){ if((Character.Rotation.x+=60*TimeDelta) >=360) Character.Rotation.x-=360; } if(keys[KEY_LEFT]){ if((Character.Rotation.y-=60*TimeDelta) <=-360) Character.Rotation.y+=360; } if(keys[KEY_RIGHT]){ if((Character.Rotation.y+=60*TimeDelta) >=360) Character.Rotation.y-=360; } - if(keys['X']){ if((Character.Rotation.z-=60*TimeDelta) <=-360) Character.Rotation.z+=360; } - if(keys['Z']){ if((Character.Rotation.z+=60*TimeDelta) >=360) Character.Rotation.z-=360; } - if(keys['K']){ Character.Translation.y-=3*TimeDelta; } - if(keys['I']){ Character.Translation.y+=3*TimeDelta; } - if(keys['J']){ Character.Translation.x-=3*TimeDelta; } - if(keys['L']){ Character.Translation.x+=3*TimeDelta; } - if(keys['N']){ AdvanceFrame(Skeleton, Animation, TimeDelta); } + if(keys['X']){ if((Character.Rotation.z-=60*TimeDelta) <=-360) Character.Rotation.z+=360; } + if(keys['Z']){ if((Character.Rotation.z+=60*TimeDelta) >=360) Character.Rotation.z-=360; } + if(keys['K']){ Character.Translation.y-=3*TimeDelta; } + if(keys['I']){ Character.Translation.y+=3*TimeDelta; } + if(keys['J']){ Character.Translation.x-=3*TimeDelta; } + if(keys['L']){ Character.Translation.x+=3*TimeDelta; } + if(keys['Q']){ if(!PressedQ){ PressedQ = 1; ShowSkeleton = !ShowSkeleton; }} else PressedQ = 0; + if(keys['N']){ AdvanceFrame(Skeleton, Animation, TimeDelta); } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Clear the screen and the depth buffer diff --git a/README.md b/README.md new file mode 100644 index 0000000..c4d97f7 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# Niotso + +[Niotso](http://niotso.org/) is the “New Implementation of The Sims Online”, aiming to restore The Sims Online as free software. + +## Binaries + +Nightlies for 32-bit Windows and 64-bit Linux are provided at http://niotso.org/pub/snapshots/. + +Stable builds and source packages are provided at http://niotso.org/pub/stable/. + +## Compiling instructions + +For compiling instructions, please see http://wiki.niotso.org/Niotso_-_Compiling_instructions. + +## Documentation + +One of these days, when we finalize the interface for a package, we will document it using doxygen. + +Documentation over the game itself (including format specifications) occurs at Niotso Wiki: +http://wiki.niotso.org/ + +## Copying + +Niotso Client and Niotso Server are distributed under the terms of the GNU GPLv3. + +While this license does permit others to compile, distribute, change, and distribute changes to Niotso, in reality, many of these freedoms cannot legally be enacted by anybody. + +Specifically, if you make changes to Niotso such that it significantly changes the "game experience as presented to the player", it cannot be distributed to others. You also may not distribute a version of Niotso that has stripped the EA or Maxis trademarked names or logos anywhere from the game. Personal use of these modifications is okay. + +These restrictions are not enforced by us, but may potentially be used by EA in attempt to take down your game. + +If you have any questions, you may visit +http://wiki.niotso.org/Niotso/Legal_Summary + +All other packages released by this project are typically either licensed under the ISC License or are public domain. \ No newline at end of file diff --git a/Tools/FARDive/CMakeLists.txt b/Tools/FARDive/CMakeLists.txt index 1622aa5..8d7b1aa 100644 --- a/Tools/FARDive/CMakeLists.txt +++ b/Tools/FARDive/CMakeLists.txt @@ -12,7 +12,7 @@ if(WIN32) windows/Dialog/AddToArchive.cpp windows/Dialog/NewArchive.cpp ) - include_directories(${CMAKE_SOURCE_DIR}/Libraries/FileHandler/libpng) + include_directories(${LIBPNG_INCLUDE_DIR}) add_executable(FARDive WIN32 ${FARDIVE_SOURCES}) target_link_libraries(FARDive ole32 uxtheme FileHandler_shared) endif() \ No newline at end of file diff --git a/Tools/TSOSimulatorClient/TSOEdithEditor/TSOEdithEditor.cpp b/Tools/TSOSimulatorClient/TSOEdithEditor/TSOEdithEditor.cpp new file mode 100644 index 0000000..0b3d132 --- /dev/null +++ b/Tools/TSOSimulatorClient/TSOEdithEditor/TSOEdithEditor.cpp @@ -0,0 +1,52 @@ +/* + TSOEdithEditor - TSOEdithEditorD.dll injector + TSOEdithEditor.cpp - Copyright (c) 2012 Niotso Project + Author(s): Fatbag + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include +#include +#include "TSOEdithEditor.hpp" + +int main(){ + HMODULE dllmodule = LoadLibrary("TSOEdithEditorD.dll"); + if(dllmodule == NULL){ + printf("TSOEdithEditor: Error: Failed to load DLL \"TSOEdithEditorD.dll\"."); + return -1; + } + + cEdithEditorCOMDirector * (__stdcall *GZDllGetGZCOMDirector)(void) = + (cEdithEditorCOMDirector * (__stdcall *)(void)) GetProcAddress(dllmodule, "GZDllGetGZCOMDirector"); + if(GZDllGetGZCOMDirector == NULL){ + printf("TSOEdithEditor: Error: Failed to find GZDllGetGZCOMDirector() in TSOEdithEditorD.dll."); + return -1; + } + + printf("TSOEdithEditor: Calling GZDllGetGZCOMDirector() ...\n"); + cEdithEditorCOMDirector * Edith = GZDllGetGZCOMDirector(); + printf("TSOEdithEditor: Finished calling GZDllGetGZCOMDirector().\nThe value returned was: %p.\n", (void *) Edith); + + while(true){ + char buffer[8]; + printf("\nCall a function (0, 1, 2, ...) or q to exit. "); + fgets(buffer, 8, stdin); + if(buffer[0] == 'q') break; + Edith->Object1.vtable5[atoi(buffer)](); + } + + printf("TSOEdithEditor: Exiting.\n"); + FreeLibrary(dllmodule); + return 0; +} \ No newline at end of file diff --git a/Tools/TSOSimulatorClient/TSOEdithEditor/TSOEdithEditor.hpp b/Tools/TSOSimulatorClient/TSOEdithEditor/TSOEdithEditor.hpp new file mode 100644 index 0000000..791588f --- /dev/null +++ b/Tools/TSOSimulatorClient/TSOEdithEditor/TSOEdithEditor.hpp @@ -0,0 +1,68 @@ +/* + TSOEdithEditor - TSOEdithEditorD.dll injector + TSOEdithEditor.hpp - Copyright (c) 2012 Fatbag + Author(s): Fatbag + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include +#pragma pack(0) + +DECLARE_INTERFACE(cUnknownObject1) +{ + DWORD Zero1; + DWORD Zero2; + void * vtable5; + char ** Strings1; + char ** Strings2; + char ** Strings3; + DWORD Zero3; + DWORD Zero4; + DWORD Zero5; + void ** Pointer1; //12 bytes + void ** Pointer2; //4 bytes + void ** Pointer3; + DWORD Flags; + DWORD * Pointer4; //4 bytes + void * Pointer5; + void * Pointer6; + DWORD Unknown11; + DWORD Unknown12; +}; + +DECLARE_INTERFACE(cEdithEditorCOMDirector) +{ + void * vtable2; + void * vtable1; + cUnknownObject1 Object1; + void * vtable4; + void * vtable3; + cUnknownObject1 Object2; + cUnknownObject1 Object3; + + DWORD Zero1; + DWORD Zero2; + DWORD Zero3; + DWORD Zero4; + DWORD Zero5; + DWORD Zero6; + DWORD Zero7; + DWORD Zero8; + DWORD Zero9; + DWORD Zero10; + DWORD Unknown1; + DWORD Pointer1; + DWORD Pointer2; + DWORD Zero11; +}; \ No newline at end of file diff --git a/Tools/TSOSimulatorClient/TSOEdithEditor/compile.bat b/Tools/TSOSimulatorClient/TSOEdithEditor/compile.bat new file mode 100644 index 0000000..4893a1f --- /dev/null +++ b/Tools/TSOSimulatorClient/TSOEdithEditor/compile.bat @@ -0,0 +1 @@ +gcc -Wall -Wextra -Wabi -pedantic -m32 -o TSOEdithEditor.exe TSOEdithEditor.cpp -mconsole \ No newline at end of file diff --git a/Tools/TSOSimulatorClient/TSOSimulatorClient.cpp b/Tools/TSOSimulatorClient/TSOSimulatorClient.cpp index d2ff4aa..a2aeacf 100644 --- a/Tools/TSOSimulatorClient/TSOSimulatorClient.cpp +++ b/Tools/TSOSimulatorClient/TSOSimulatorClient.cpp @@ -1,6 +1,6 @@ /* TSOSimulatorClient - TSOSimulatorClientD.dll injector - iff2html.c - Copyright (c) 2012 Niotso Project + TSOSimulatorClient.cpp - Copyright (c) 2012 Niotso Project Author(s): Fatbag Permission to use, copy, modify, and/or distribute this software for any @@ -26,20 +26,20 @@ int main(){ printf("TSOSimulatorClient: Error: Failed to load DLL \"TSOSimulatorClientD.dll\"."); return -1; } - - GZCOMDirector * (__stdcall *GZDllGetGZCOMDirector)(void) = - (GZCOMDirector * (__stdcall *)(void)) GetProcAddress(dllmodule, "GZDllGetGZCOMDirector"); + + cTSOSimulatorClientDCOMDirector * (__stdcall *GZDllGetGZCOMDirector)(void) = + (cTSOSimulatorClientDCOMDirector * (__stdcall *)(void)) GetProcAddress(dllmodule, "GZDllGetGZCOMDirector"); if(GZDllGetGZCOMDirector == NULL){ printf("TSOSimulatorClient: Error: Failed to find GZDllGetGZCOMDirector() in TSOSimulatorClientD.dll."); return -1; } - + printf("TSOSimulatorClient: Calling GZDllGetGZCOMDirector() ...\n"); - GZCOMDirector * Simulator = GZDllGetGZCOMDirector(); + cTSOSimulatorClientDCOMDirector * Simulator = GZDllGetGZCOMDirector(); printf("TSOSimulatorClient: Finished calling GZDllGetGZCOMDirector().\nThe value returned was: %p.\n", (void *) Simulator); - + printf("%s\n%s\n%s\n", Simulator->Object1.Strings1[0], Simulator->Object1.Strings2[0], Simulator->Object1.Strings3[0]); - + printf("TSOSimulatorClient: Exiting.\n"); FreeLibrary(dllmodule); return 0; diff --git a/Tools/TSOSimulatorClient/TSOSimulatorClient.hpp b/Tools/TSOSimulatorClient/TSOSimulatorClient.hpp index 58ff3a8..076ff00 100644 --- a/Tools/TSOSimulatorClient/TSOSimulatorClient.hpp +++ b/Tools/TSOSimulatorClient/TSOSimulatorClient.hpp @@ -1,5 +1,7 @@ /* + TSOSimulatorClient - TSOSimulatorClientD.dll injector TSOSimulatorClient.hpp - Copyright (c) 2012 Fatbag + Author(s): Fatbag Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -17,7 +19,7 @@ #include #pragma pack(0) -DECLARE_INTERFACE(UnknownObject1_t) +DECLARE_INTERFACE(cUnknownObject1) { DWORD Zero1; DWORD Zero2; @@ -39,15 +41,15 @@ DECLARE_INTERFACE(UnknownObject1_t) DWORD Unknown12; }; -DECLARE_INTERFACE(GZCOMDirector) +DECLARE_INTERFACE(cTSOSimulatorClientDCOMDirector) { void * vtable2; void * vtable1; - UnknownObject1_t Object1; + cUnknownObject1 Object1; void * vtable4; void * vtable3; - UnknownObject1_t Object2; - UnknownObject1_t Object3; + cUnknownObject1 Object2; + cUnknownObject1 Object3; DWORD Zero1; DWORD Zero2; diff --git a/Tools/iff2html/CMakeLists.txt b/Tools/iff2html/CMakeLists.txt index 308f5cc..fc1ac5e 100644 --- a/Tools/iff2html/CMakeLists.txt +++ b/Tools/iff2html/CMakeLists.txt @@ -9,7 +9,7 @@ set(IFF2HTML_SOURCES ../../Libraries/FileHandler/bmp/read_bmp.c ) -include_directories(${CMAKE_SOURCE_DIR}/Libraries/FileHandler) +include_directories(${FILEHANDLER_INCLUDE_DIR} ${LIBPNG_INCLUDE_DIR}) add_executable(iff2html ${IFF2HTML_SOURCES}) target_link_libraries(iff2html iff_static libpng_static zlib_static m) diff --git a/Tools/iff2html/image.c b/Tools/iff2html/image.c index fc0ef30..ca7c0f0 100644 --- a/Tools/iff2html/image.c +++ b/Tools/iff2html/image.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include "opngreduc.h" int WritePNG(const char * OutName, const IFFChunk * ChunkData, int ZBuffer, diff --git a/Tools/iff2html/opngreduc.h b/Tools/iff2html/opngreduc.h index b0ab92e..6e5018c 100644 --- a/Tools/iff2html/opngreduc.h +++ b/Tools/iff2html/opngreduc.h @@ -12,7 +12,7 @@ #ifndef OPNGREDUC_H #define OPNGREDUC_H -#include +#include #ifdef __cplusplus diff --git a/Tools/inputtest/Readme.txt b/Tools/inputtest/Readme.txt new file mode 100644 index 0000000..cb105bb --- /dev/null +++ b/Tools/inputtest/Readme.txt @@ -0,0 +1 @@ +This is for testing Windows input messages, at the moment. \ No newline at end of file diff --git a/Tools/inputtest/compile.bat b/Tools/inputtest/compile.bat new file mode 100644 index 0000000..ccaed26 --- /dev/null +++ b/Tools/inputtest/compile.bat @@ -0,0 +1 @@ +gcc -Wall -Wextra -Wabi -pedantic -m32 -o inputtest.exe inputtest.cpp -mconsole \ No newline at end of file diff --git a/Tools/inputtest/inputtest.cpp b/Tools/inputtest/inputtest.cpp new file mode 100644 index 0000000..0cec43d --- /dev/null +++ b/Tools/inputtest/inputtest.cpp @@ -0,0 +1,96 @@ +/* + inputtest - Windows input testing + inputtest.cpp - Copyright (c) 2012 Niotso Project + Author(s): Fatbag + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include +#include + +static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ + switch(uMsg){ + + case WM_KEYDOWN: + printf("[WM_KEYDOWN] key = %u, lParam = %lu\n", wParam, lParam); + return 0; + case WM_KEYUP: + printf("[WM_KEYUP] key = %u, lParam = %lu\n", wParam, lParam); + return 0; + case WM_CHAR: + printf("[WM_CHAR] key = %u, lParam = %lu\n", wParam, lParam); + return 0; + case WM_DEADCHAR: + printf("[WM_DEADCHAR] key = %u, lParam = %lu\n", wParam, lParam); + return 0; + case WM_SYSKEYDOWN: + printf("[WM_SYSKEYDOWN] key = %u, lParam = %lu\n", wParam, lParam); + return 0; + case WM_SYSKEYUP: + printf("[WM_SYSKEYUP] key = %u, lParam = %lu\n", wParam, lParam); + return 0; + case WM_SYSDEADCHAR: + printf("[WM_SYSDEADCHAR] key = %u, lParam = %lu\n", wParam, lParam); + return 0; + case WM_HOTKEY: + printf("[WM_HOTKEY] keys1 = %u, keys2 = %lu\n", wParam, lParam); + return 0; + case WM_APPCOMMAND: + printf("[WM_APPCOMMAND] cmd = %u, device = %u, keys = %u\n", GET_APPCOMMAND_LPARAM(lParam), GET_DEVICE_LPARAM(lParam), GET_KEYSTATE_LPARAM(lParam)); + return 0; + + case WM_CLOSE: + PostQuitMessage(0); + return 0; + + } + + printf("Received message %u with wParam = %u, lParam = %lu\n", uMsg, wParam, lParam); + return DefWindowProc(hWnd, uMsg, wParam, lParam); +} + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int) +{ + const WNDCLASS wc = { + 0, //style + WndProc, //lpfnWndProc + 0, //cbClsExtra + 0, //cbWndExtra + hInstance, //hInstance + (HICON) LoadImage(NULL, IDI_APPLICATION, //hIcon + IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE), + (HCURSOR) LoadImage(NULL, IDC_ARROW, //hCursor + IMAGE_CURSOR, 0, 0, LR_SHARED | LR_DEFAULTSIZE), + (HBRUSH) COLOR_WINDOW, //hbrBackground + NULL, //lpszMenuName + "INPUTTEST" //lpszClassName + }; + + RegisterClass(&wc); + + // Create the main window. + const HWND hWnd = CreateWindowEx(WS_EX_APPWINDOW, "INPUTTEST", "Input test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + CW_USEDEFAULT, CW_USEDEFAULT, 200, 200, 0, 0, hInstance, NULL); + + SetForegroundWindow(hWnd); + SetFocus(hWnd); + + MSG msg; + while(GetMessage(&msg, NULL, 0, 0)){ + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + return 0; +} \ No newline at end of file diff --git a/Tools/tsoscan/CMakeLists.txt b/Tools/tsoscan/CMakeLists.txt index fdb1cd5..4a602f7 100644 --- a/Tools/tsoscan/CMakeLists.txt +++ b/Tools/tsoscan/CMakeLists.txt @@ -7,7 +7,7 @@ set(TSOSCAN_SOURCES stats.c ) -include_directories(${CMAKE_SOURCE_DIR}/Libraries/FileHandler) +include_directories(${FILEHANDLER_INCLUDE_DIR}) add_executable(tsoscan ${TSOSCAN_SOURCES}) target_link_libraries(tsoscan iff_static) \ No newline at end of file diff --git a/update-libraries.bat b/update-libraries.bat new file mode 100644 index 0000000..337f5b3 --- /dev/null +++ b/update-libraries.bat @@ -0,0 +1 @@ +mkdir _deps 2>NUL & mingw32-make -C _deps -f ../update-libraries.mk CMD=1 \ No newline at end of file diff --git a/update-libraries.mk b/update-libraries.mk new file mode 100644 index 0000000..7a2fad3 --- /dev/null +++ b/update-libraries.mk @@ -0,0 +1,12 @@ +LIBS = freetype libjpeg-turbo libmpg123 libpng libpq zlib +all: .PHONY ../_deps/$(LIBS) +.PHONY: $(LIBS) + wget -N http://niotso.org/pub/environment/windows/lib/$<.tar.xz +../_deps/%: %.tar.xz +ifdef CMD + del /F /S /Q "$@" +else + rm -rf "$@/*" +endif + xzdec $< | tar -x + echo . > "$@/temp" \ No newline at end of file diff --git a/update-libraries.sh b/update-libraries.sh new file mode 100644 index 0000000..e665f4f --- /dev/null +++ b/update-libraries.sh @@ -0,0 +1 @@ +mkdir _deps; make -C _deps -f ../update-libraries.mk \ No newline at end of file