Skip to content

Commit

Permalink
v2.6.1-luajit: Merge master into luajit
Browse files Browse the repository at this point in the history
  • Loading branch information
MCJack123 committed Aug 31, 2021
2 parents 79026c2 + 1cca6ab commit d2b7f5f
Show file tree
Hide file tree
Showing 42 changed files with 1,284 additions and 462 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y libsdl2-dev libsdl2-mixer-dev libhpdf-dev libpng++-dev libpoco-dev libncurses5-dev
sudo apt install -y libsdl2-dev libsdl2-mixer-dev libhpdf-dev libpng++-dev libwebp-dev libpoco-dev libncurses5-dev
- name: Build CraftOS-PC
run: |
git submodule update --init --recursive
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y libsdl2-dev libsdl2-mixer-dev libhpdf-dev libpng++-dev libpoco-dev libncurses5-dev nodejs
sudo apt install -y libsdl2-dev libsdl2-mixer-dev libhpdf-dev libpng++-dev libwebp-dev libpoco-dev libncurses5-dev nodejs
- name: Build standalone ROM
run: |
git clone https://github.com/MCJack123/craftos2-rom
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y libsdl2-dev libsdl2-mixer-dev libhpdf-dev libpng++-dev libpoco-dev libncurses5-dev
sudo apt install -y libsdl2-dev libsdl2-mixer-dev libhpdf-dev libpng++-dev libwebp-dev libpoco-dev libncurses5-dev
- name: Build CraftOS-PC
run: |
git submodule update --init --recursive
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ vcpkg_installed
/src/apikey.cpp
*.dylib
*.so
*.bundle
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dist: bionic
before_install:
- git submodule update --init --recursive
- sudo git clone https://github.com/MCJack123/craftos2-rom /usr/local/share/craftos
- sudo apt install -y libsdl2-dev libsdl2-mixer-dev libhpdf-dev libpng++-dev libpoco-dev libncurses-dev
- sudo apt install -y libsdl2-dev libsdl2-mixer-dev libhpdf-dev libpng++-dev libwebp-dev libpoco-dev libncurses-dev
addons:
apt:
update: true
19 changes: 14 additions & 5 deletions CraftOS-PC 2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Link>
<AdditionalLibraryDirectories>$(SolutionDir)craftos2-luajit\src;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;luajit51d.lib;shlwapi.lib;ws2_32.lib;wldap32.lib;wer.lib;crypt32.lib;normaliz.lib;SDL2maind.lib;iphlpapi.lib;libpng16d.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;luajit51d.lib;shlwapi.lib;ws2_32.lib;wldap32.lib;wer.lib;crypt32.lib;normaliz.lib;SDL2maind.lib;iphlpapi.lib;libpng16d.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Console</SubSystem>
<AdditionalOptions>/VERBOSE:LIB %(AdditionalOptions)</AdditionalOptions>
<Profile>true</Profile>
Expand All @@ -358,6 +358,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<DisableSpecificWarnings>C26812;C4005</DisableSpecificWarnings>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
Expand Down Expand Up @@ -393,7 +394,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Link>
<AdditionalLibraryDirectories>$(SolutionDir)craftos2-luajit\src;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;luajit51.lib;shlwapi.lib;ws2_32.lib;wldap32.lib;crypt32.lib;normaliz.lib;SDL2main.lib;iphlpapi.lib;libpng16.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;luajit51.lib;shlwapi.lib;ws2_32.lib;wldap32.lib;crypt32.lib;normaliz.lib;SDL2main.lib;iphlpapi.lib;libpng16.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
Expand All @@ -406,6 +407,7 @@
<AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<DisableSpecificWarnings>26812;4005</DisableSpecificWarnings>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
Expand Down Expand Up @@ -438,7 +440,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStandalone|x64'">
<Link>
<AdditionalLibraryDirectories>$(SolutionDir)craftos2-luajit\src;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;luajit51.lib;shlwapi.lib;ws2_32.lib;wldap32.lib;crypt32.lib;normaliz.lib;SDL2main.lib;iphlpapi.lib;libpng16.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;luajit51.lib;shlwapi.lib;ws2_32.lib;wldap32.lib;crypt32.lib;normaliz.lib;SDL2main.lib;iphlpapi.lib;libpng16.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
Expand All @@ -451,6 +453,7 @@
<AdditionalOptions>$(ExternalCompilerOptions) %(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<DisableSpecificWarnings>C26812;C4005</DisableSpecificWarnings>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
Expand Down Expand Up @@ -483,7 +486,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseC|x64'">
<Link>
<AdditionalLibraryDirectories>$(SolutionDir)craftos2-luajit\src;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;luajit51.lib;sdl2.lib;shlwapi.lib;ws2_32.lib;wldap32.lib;crypt32.lib;normaliz.lib;SDL2main.lib;SDL2_mixer.lib;iphlpapi.lib;libpng16.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;luajit51.lib;sdl2.lib;shlwapi.lib;ws2_32.lib;wldap32.lib;crypt32.lib;normaliz.lib;SDL2main.lib;SDL2_mixer.lib;iphlpapi.lib;libpng16.lib;comctl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
Expand All @@ -496,6 +499,7 @@
<AdditionalOptions>$(ExternalCompilerOptions) /d2SSAOptimizer- %(AdditionalOptions)</AdditionalOptions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<DisableSpecificWarnings>26812;4005</DisableSpecificWarnings>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
Expand Down Expand Up @@ -652,7 +656,12 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="src\gif.cpp" />
<ClCompile Include="src\gif.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseC|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseStandalone|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="src\plugin.cpp" />
<ClCompile Include="src\util.cpp" />
<ClCompile Include="src\main.cpp" />
Expand Down
29 changes: 21 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ Visit the website at https://www.craftos-pc.cc/ for more information, including
* Supported operating systems:
* Windows Vista x64 or later
* macOS 10.9.5+
* Ubuntu 18.04, 19.10, 20.04
* Ubuntu 18.04, 20.04, 21.04
* Arch Linux with AUR helper
* iOS 11.0+
* Android 7.0+
* Administrator privileges
* 20 MB free space
* 20-50 MB free space

## Installing
### Windows
Expand Down Expand Up @@ -42,6 +44,14 @@ $ sudo apt install craftos-pc-accelerated
$ craftos
```

### iOS
[Visit the App Store](https://apps.apple.com/us/app/craftos-pc/id1565893014) to download CraftOS-PC. Or you can [join the TestFlight beta](https://testflight.apple.com/join/SiuXlijR) to get access to the latest versions before they're released.

### Android
1. Download CraftOS-PC.apk from the latest release
2. Open the file and tap "Install"
3. Open CraftOS-PC from the app drawer or home screen

### Arch Linux
Install the `craftos-pc-accelerated` package using your chosen AUR helper (e.g. `yay -S craftos-pc-accelerated`).

Expand All @@ -60,7 +70,7 @@ CraftOS-PC v2.2 moves the save directory to be more appropriate for each platfor
* Windows: Visual Studio 2019
* LuaJIT 2.0
* SDL 2.0.8+ (may work on older versions on non-Linux)
* OpenSSL 1.1 (for POCO)
* OpenSSL 1.1.1 (for POCO)
* POCO 1.5.0+: NetSSL & JSON libraries + dependencies
* Foundation
* Util
Expand All @@ -69,12 +79,15 @@ CraftOS-PC v2.2 moves the save directory to be more appropriate for each platfor
* JSON
* Net
* NetSSL
* On Windows, you'll need to modify the `poco` port to use OpenSSL. Simply open `vcpkg\ports\poco\portfile.cmake`, find `ENABLE_NETSSL_WIN`, and replace it with `FORCE_OPENSSL`. Then install as normal.
* Windows: dirent.h (install with NuGet OR vcpkg)
* Windows: [vcpkg](https://github.com/microsoft/vcpkg)

#### Optional
* libpng 1.6 & png++ 0.2.7+
* Can be disabled with `--without-png`, will save as BMP instead
* libwebp
* Can be disabled with `--without-webp`, will disable WebP support (`useWebP` option will always be off)
* [libharu/libhpdf](https://github.com/libharu/libharu)
* Can be disabled with `--without-hpdf`, `--with-html` or `--with-txt`
* ncurses or PDCurses
Expand All @@ -83,18 +96,18 @@ CraftOS-PC v2.2 moves the save directory to be more appropriate for each platfor
* Can be disabled with `--without-sdl_mixer`, will disable audio disc and speaker support
* For MP3 support, libmpg123 is required
* For FLAC support, libFLAC is required
* For SF2 support, SDL_mixer must be built manually with fluidsynth support
* For SF2 support, SDL_mixer must be built manually with fluidsynth support (or with the `fluidsynth` feature in vcpkg since July 9, 2021)
* The path to the ROM package can be changed with `--prefix=<path>`, which will store the ROM at `<path>/share/craftos`
* Standalone builds can be enabled with `--with-standalone-rom=<fs_standalone.cpp>`, with `<fs_standalone.cpp>` referring to the path to the packed standalone ROM file.
* The latest packed ROM can be downloaded as an artifact from the latest CI build, found by following the top link [here](https://github.com/MCJack123/craftos2-rom/actions).

You can get all of these dependencies with:
* Windows: `vcpkg --feature-flags=manifests install --triplet x64-windows` inside the repository directory
* Visual Studio will do this for you automatically (as long as vcpkg integration is installed)
* Windows (manual): `vcpkg install sdl2:x64-windows sdl2-mixer[dynamic-load,libflac,mpg123,libmodplug,libvorbis,opusfile,fluidsynth]:x64-windows pngpp:x64-windows libharu:x64-windows poco[netssl]:x64-windows dirent:x64-windows pdcurses:x64-windows`
* Mac (Homebrew): `brew install sdl2 sdl2_mixer png++ libharu poco ncurses; git clone https://github.com/MCJack123/craftos2-rom`
* Ubuntu: `sudo apt install git build-essential libsdl2-dev libsdl2-mixer-dev libhpdf-dev libpng++-dev libpoco-dev libncurses5-dev; git clone https://github.com/MCJack123/craftos2-rom`
* Arch Linux: `sudo pacman -S sdl2 sdl2_mixer png++ libharu poco ncurses`
* Windows (manual): `vcpkg install sdl2:x64-windows sdl2-mixer[dynamic-load,libflac,mpg123,libmodplug,libvorbis,opusfile,fluidsynth]:x64-windows pngpp:x64-windows libwebp:x64-windows libharu:x64-windows poco[netssl]:x64-windows dirent:x64-windows pdcurses:x64-windows`
* Mac (Homebrew): `brew install sdl2 sdl2_mixer png++ webp libharu poco ncurses; git clone https://github.com/MCJack123/craftos2-rom`
* Ubuntu: `sudo apt install git build-essential libsdl2-dev libsdl2-mixer-dev libhpdf-dev libpng++-dev libwebp-dev libpoco-dev libncurses5-dev; git clone https://github.com/MCJack123/craftos2-rom`
* Arch Linux: `sudo pacman -S sdl2 sdl2_mixer png++ libwebp libharu poco ncurses`

### Windows Nightly Builds
Nightly builds of CraftOS-PC are available [on the website](https://www.craftos-pc.cc/nightly/). These builds are provided to allow Windows users to test new features without having to build the entire solution and dependencies. New builds are posted at midnight EST, unless there were no changes since the last build. Note that these files are just the raw executable. You must drop the file into a pre-existing CraftOS-PC install directory for it to work properly. Depending on changes made in the latest version, you may also have to download the latest [ROM](https://github.com/MCJack123/craftos2-rom).
Expand Down
4 changes: 4 additions & 0 deletions api/Computer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ struct Computer {
std::mutex rawFileStackMutex; // A mutex locking rawFileStack
int fileUploadCount = 0; // Stores the number of files that have been uploaded in the current set (if 0, no set is active)

// The following fields are available in API version 10.5 and later.
std::queue<void*> httpRequestQueue; // Queue for HTTP requests that are past the limit
std::mutex httpRequestQueueMutex; // A mutex locking httpRequestQueueMutex

private:
// The constructor is marked private to avoid having to implement it in this file.
// It isn't necessary to construct a Computer directly; just use the startComputer function instead.
Expand Down
9 changes: 6 additions & 3 deletions api/configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ struct configuration {

// The following fields are available in API version 10.3 and later.
bool keepOpenOnShutdown;

// The following fields are available in API version 10.5 and later.
bool useWebP;
};

// A smaller structure that holds the configuration for a single computer.
Expand All @@ -95,9 +98,9 @@ struct computer_configuration {
bool loadFailure;
bool startFullscreen;

// The following fields are available in API version 10.3 and later.
int computerWidth;
int computerHeight;
// The following fields are available in API version 10.3 and later.
int computerWidth;
int computerHeight;
};

#endif
2 changes: 2 additions & 0 deletions api/lib.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct library_t {
std::function<void(Computer*)> deinit; // A function to call when closing the API
};

#ifdef CRAFTOS_PC_HPP
/**
* Returns the associated Computer object pointer for a Lua state.
* This is a bit slow, so try not to call it too much, or cache results.
Expand All @@ -64,5 +65,6 @@ inline Computer * get_comp(lua_State *L) {
lua_pop(L, 1);
return (Computer*)retval;
}
#endif

#endif
Loading

0 comments on commit d2b7f5f

Please sign in to comment.