Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into luajit
Browse files Browse the repository at this point in the history
  • Loading branch information
MCJack123 committed Jan 2, 2024
2 parents fee05f5 + 72392cc commit 5cfd180
Show file tree
Hide file tree
Showing 97 changed files with 770 additions and 657 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- "resources/CCT-Tests.patch"
- "resources/CraftOSTest.lua"
- "Makefile.in"
- "resources/CCT-Tests.patch"
pull_request:
paths:
- "src/**"
Expand Down Expand Up @@ -109,7 +110,7 @@ jobs:
- name: Download ROM & CC:T
run: |
sudo git clone https://github.com/MCJack123/craftos2-rom /usr/local/share/craftos
git clone --branch v1.19.4-1.106.0 https://github.com/SquidDev-CC/CC-Tweaked ../CC-Tweaked
git clone --branch v1.20.1-1.109.2 https://github.com/cc-tweaked/CC-Tweaked ../CC-Tweaked
patch -p1 -d ../CC-Tweaked < resources/CCT-Tests.patch
- name: Install dependencies
run: |
Expand Down
24 changes: 22 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,25 @@ jobs:
asset_path: CraftOS-PC.dmg
asset_name: CraftOS-PC.dmg
asset_content_type: application/octet-stream

release-mac-homebrew:
name: Update Mac Homebrew cask
runs-on: ubuntu-latest
needs: [release-mac]
environment: production
steps:
- name: Download repo
uses: actions/checkout@v4
with:
repository: MCJack123/homebrew-CraftOSPC
ref: 'master'
token: ${{ secrets.HOMEBREW_GITHUB_TOKEN }}
- name: Update file
run: |
sed -e 's/version "[^"]*"/version "'${GITHUB_REF:1}'"/' -e 's/sha256 "[^"]*"/sha256 "'$(curl -sL https://github.com/MCJack123/releases/$GITHUB_REF/download/CraftOS-PC.dmg | shasum -a 256 | awk '{print $1;}')'"/' Casks/craftos-pc.rb > tmp.rb
mv tmp.rb Casks/craftos-pc.rb
- name: Upload
run: git commit -m $GITHUB_REF && git push origin master

release-ubuntu:
name: Upload Ubuntu PPA package
Expand Down Expand Up @@ -250,7 +269,7 @@ jobs:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
run: |
sudo apt update
sudo apt install -y libsdl2-dev libsdl2-mixer-dev libhpdf-dev libpng++-dev libwebp-dev libpoco-dev libncurses5-dev patchelf
sudo apt install -y libsdl2-dev libsdl2-mixer-dev libhpdf-dev libpng++-dev libwebp-dev libpoco-dev libncurses5-dev patchelf lua5.4
sudo curl -sLo /usr/bin/appimagetool https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage
sudo chmod a+x /usr/bin/appimagetool
echo "$GPG_SIGNING_KEY" > signing.asc
Expand Down Expand Up @@ -294,7 +313,8 @@ jobs:
ldd ./craftos | grep -o '/lib/[^ ]*\.so[^ :]*' | grep -Ev 'libstdc\+\+|libm\.|libgcc|libc\.|libX|libx|libpulse|libdbus|libsystemd|libreadline|libpthread|libdl|librt|libbsd|libnsl|libresolv' | sort | uniq | tee /dev/stderr | xargs -I {} cp -Lp {} AppDir/usr/lib
cp -Lp /lib/x86_64-linux-gnu/libX11.so.6 AppDir/usr/lib
mkdir -p AppDir/etc/ssl/certs
cp -Lp /etc/ssl/certs/ca-certificates.crt AppDir/etc/ssl/certs
cp -Lp /etc/ssl/certs/ca-certificates.crt AppDir/usr/lib/ssl/cert.pem
lua -e 'local file = assert(io.open("AppDir/usr/lib/libcrypto.so.1.1", "rb")) local data = file:read("*a") file:close() file = assert(io.open("AppDir/usr/lib/libcrypto.so.1.1", "wb")) file:write(data:gsub("/usr(/lib/ssl[^\0]*\0)", ".%1\0\0\0")) file:close()'
appimagetool -s AppDir CraftOS-PC.x86_64.AppImage
- name: Upload AppImage
uses: shogo82148/[email protected]
Expand Down
5 changes: 4 additions & 1 deletion CraftOS-PC 2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard_C>stdc11</LanguageStandard_C>
<DisableSpecificWarnings>26812;4005</DisableSpecificWarnings>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
Expand Down Expand Up @@ -417,6 +418,7 @@
<LanguageStandard_C>stdc11</LanguageStandard_C>
<DisableSpecificWarnings>26812;4005</DisableSpecificWarnings>
<LanguageStandard>stdcpp17</LanguageStandard>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
Expand Down Expand Up @@ -465,6 +467,7 @@
<LanguageStandard_C>stdc11</LanguageStandard_C>
<DisableSpecificWarnings>26812;4005</DisableSpecificWarnings>
<LanguageStandard>stdcpp17</LanguageStandard>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
Expand Down Expand Up @@ -513,6 +516,7 @@
<LanguageStandard_C>stdc17</LanguageStandard_C>
<DisableSpecificWarnings>26812;4005</DisableSpecificWarnings>
<LanguageStandard>stdcpp17</LanguageStandard>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<ProjectReference>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
Expand Down Expand Up @@ -547,7 +551,6 @@
<None Include=".github\workflows\main.yml" />
<None Include=".github\workflows\release.yml" />
<None Include=".gitignore" />
<None Include=".travis.yml" />
<None Include="configure.ac" />
<None Include="DOCUMENTATION.md" />
<None Include="LICENSE" />
Expand Down
3 changes: 0 additions & 3 deletions CraftOS-PC 2.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
<None Include=".travis.yml">
<Filter>Other Files</Filter>
</None>
<None Include="DOCUMENTATION.md">
<Filter>Other Files</Filter>
</None>
Expand Down
4 changes: 2 additions & 2 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@ int multiply(lua_State *L) {
_declspec(dllexport)
#endif
int luaopen_example(lua_State *L) {
struct luaL_reg M[] =
struct luaL_Reg M[] =
{
{"addition", addition},
{"multiply", multiply},
{NULL,NULL}
};

luaL_register(L, "example", M);
luaL_Register(L, "example", M);
return 1;
}

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019-2023 JackMacWindows
Copyright (c) 2019-2024 JackMacWindows

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Visit the website at https://www.craftos-pc.cc/ for more information, including
* Arch Linux with AUR helper
* iOS 11.0+
* Android 7.0+
* Administrator privileges
* 20-50 MB free space

## Installing
Expand Down
4 changes: 2 additions & 2 deletions api/Computer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* computer.
*
* This code is licensed under the MIT license.
* Copyright (c) 2019-2023 JackMacWindows.
* Copyright (c) 2019-2024 JackMacWindows.
*/

#ifndef CRAFTOS_PC_COMPUTER_HPP
Expand Down Expand Up @@ -132,7 +132,7 @@ struct Computer {
std::mutex openWebsocketsMutex;
std::vector<std::pair<lua_CFunction, void*>> startupCallbacks; // List of functions to call when starting up + a userdata to pass as the first argument

// The following fields are available in API version 10.9 and later.
// The following fields are available in API version 12.0 and later.
std::vector<std::filesystem::path> droppedFiles; // List of files that were dropped in the current drop set

private:
Expand Down
2 changes: 1 addition & 1 deletion api/CraftOS-PC.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* This file is the main header for plugins to import CraftOS-PC's API.
*
* This code is licensed under the MIT license.
* Copyright (c) 2019-2023 JackMacWindows.
* Copyright (c) 2019-2024 JackMacWindows.
*/

#ifndef CRAFTOS_PC_HPP
Expand Down
2 changes: 1 addition & 1 deletion api/FileEntry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* including the standalone ROM.
*
* This code is licensed under the MIT license.
* Copyright (c) 2019-2023 JackMacWindows.
* Copyright (c) 2019-2024 JackMacWindows.
*/

#ifndef CRAFTOS_PC_FILEENTRY_HPP
Expand Down
2 changes: 1 addition & 1 deletion api/Terminal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* renderer classes.
*
* This code is licensed under the MIT license.
* Copyright (c) 2019-2023 JackMacWindows.
* Copyright (c) 2019-2024 JackMacWindows.
*/

#ifndef CRAFTOS_PC_TERMINAL_HPP
Expand Down
2 changes: 1 addition & 1 deletion api/configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* This file defines structures used for storing the configuration.
*
* This code is licensed under the MIT license.
* Copyright (c) 2019-2023 JackMacWindows.
* Copyright (c) 2019-2024 JackMacWindows.
*/

#ifndef CRAFTOS_PC_CONFIGURATION_HPP
Expand Down
2 changes: 1 addition & 1 deletion api/generic_peripheral/energy_storage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* to inherit from.
*
* This code is licensed under the MIT license.
* Copyright (c) 2019-2023 JackMacWindows.
* Copyright (c) 2019-2024 JackMacWindows.
*/

#ifndef CRAFTOS_PC_GENERIC_PERIPHERAL_ENERGY_STORAGE_HPP
Expand Down
2 changes: 1 addition & 1 deletion api/generic_peripheral/fluid_storage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* to inherit from.
*
* This code is licensed under the MIT license.
* Copyright (c) 2019-2023 JackMacWindows.
* Copyright (c) 2019-2024 JackMacWindows.
*/

#ifndef CRAFTOS_PC_GENERIC_PERIPHERAL_FLUID_STORAGE_HPP
Expand Down
2 changes: 1 addition & 1 deletion api/generic_peripheral/inventory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* to inherit from.
*
* This code is licensed under the MIT license.
* Copyright (c) 2019-2023 JackMacWindows.
* Copyright (c) 2019-2024 JackMacWindows.
*/

#ifndef CRAFTOS_PC_GENERIC_PERIPHERAL_INVENTORY_HPP
Expand Down
2 changes: 1 addition & 1 deletion api/lib.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* This file defines some functions and constants useful for plugins.
*
* This code is licensed under the MIT license.
* Copyright (c) 2019-2023 JackMacWindows.
* Copyright (c) 2019-2024 JackMacWindows.
*/

#ifndef CRAFTOS_PC_LIB_HPP
Expand Down
4 changes: 1 addition & 3 deletions api/peripheral.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* This file creates the base class for all peripherals to inherit.
*
* This code is licensed under the MIT license.
* Copyright (c) 2019-2023 JackMacWindows.
* Copyright (c) 2019-2024 JackMacWindows.
*/

#ifndef CRAFTOS_PC_PERIPHERAL_HPP
Expand Down Expand Up @@ -56,9 +56,7 @@ class peripheral {
virtual int call(lua_State *L, const char * method)=0;
// This function is deprecated, and no longer works. In fact, it did not work
// in any version of the API. Just leave this as-is.
#if __cplusplus >= 201402L
[[deprecated]]
#endif
virtual void update() {}
// This function should return a library_t containing the names of all of the
// methods available to the peripheral. Only the keys, name, and size members
Expand Down
10 changes: 5 additions & 5 deletions examples/ccemux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* programs when run in CraftOS-PC.
*
* This code is licensed under the MIT License.
* Copyright (c) 2019-2023 JackMacWindows.
* Copyright (c) 2019-2024 JackMacWindows.
*/

extern "C" {
Expand Down Expand Up @@ -145,11 +145,11 @@ static int ccemux_getVersion(lua_State *L) {

static int ccemux_openEmu(lua_State *L) {
Computer * comp = get_comp(L);
int id = 0;
int id = luaL_optinteger(L, 1, -1);
if (lua_isnumber(L, 1)) id = (int)lua_tointeger(L, 1);
else if (!lua_isnoneornil(L, 1)) luaL_typerror(L, 1, "number");
else {
if (id < 0) {
std::lock_guard<std::mutex> lock(comp->peripherals_mutex);
id = 0;
while (functions->getComputerById(id) != NULL) id++;
}
if (functions->attachPeripheral(comp, "computer_" + std::to_string(id), "computer", NULL, "") == NULL) lua_pushnil(L);
Expand Down Expand Up @@ -252,7 +252,7 @@ static PluginInfo info("ccemux", 3);

extern "C" {
DLLEXPORT int luaopen_ccemux(lua_State *L) {
luaL_register(L, lua_tostring(L, 1), M);
luaL_newlib(L, M);
functions->addVirtualMount(get_comp(L), emuROM, "/rom");
return 1;
}
Expand Down
4 changes: 2 additions & 2 deletions examples/plugin_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extern "C" {

// add your functions here...

static luaL_reg M[] = {
static luaL_Reg M[] = {
// add functions here as {name, function}...
{NULL, NULL}
};
Expand All @@ -26,7 +26,7 @@ static PluginInfo info("myplugin");
extern "C" {
// replace "myplugin" with the plugin name
DLLEXPORT int luaopen_myplugin(lua_State *L) {
luaL_register(L, "myplugin", M);
luaL_newlib(L, M);
return 1;
}

Expand Down
2 changes: 1 addition & 1 deletion resources/CCT-Test-Bootstrap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ end
for _,v in ipairs(fs.list("/")) do if not fs.isReadOnly(v) then fs.delete(v) end end
_G._CCPC_FIRST_RUN = nil
_G._CCPC_UPDATED_VERSION = nil
local logfile = io.open("test-log.txt", "w")
local logfile = assert(io.open("test-log.txt", "w"))
io.output(logfile)
shell.run("/test-rom/mcfly /test-rom/spec")
logfile:close()
Expand Down
58 changes: 29 additions & 29 deletions resources/CCT-Tests.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ diff -ruN --strip -x .DS_Store projects/core/src/test/resources/test-rom/mcfly.l
diff -ruN --strip -x .DS_Store projects/core/src/test/resources/test-rom/spec/apis/fs_spec.lua b/projects/core/src/test/resources/test-rom/spec/apis/fs_spec.lua
--- a/projects/core/src/test/resources/test-rom/spec/apis/fs_spec.lua 2020-06-29 02:52:34.000000000 -0400
+++ b/projects/core/src/test/resources/test-rom/spec/apis/fs_spec.lua 2020-06-29 01:24:00.000000000 -0400
@@ -122,7 +122,7 @@
@@ -88,7 +88,6 @@
describe("fs.list", function()
it("fails on files", function()
expect.error(fs.list, "rom/startup.lua"):eq("/rom/startup.lua: Not a directory")
- expect.error(fs.list, "startup.lua"):eq("/startup.lua: Not a directory")
end)

it("fails on non-existent nodes", function()
@@ -122,7 +121,7 @@

describe("fs.makeDir", function()
it("fails on files", function()
Expand All @@ -18,7 +26,7 @@ diff -ruN --strip -x .DS_Store projects/core/src/test/resources/test-rom/spec/ap
end)

it("fails on read-only mounts", function()
@@ -171,7 +171,7 @@
@@ -171,7 +170,7 @@
end)

it("returns the capacity on the root mount", function()
Expand All @@ -42,6 +50,25 @@ diff -ruN --strip -x .DS_Store projects/core/src/test/resources/test-rom/spec/lu
- expect.error(redstone.setOutput, value):eq("bad argument #1 (string expected, got some type)")
- end)
-end)
diff -ruN --strip -x .DS_Store projects/core/src/test/resources/test-rom/spec/apis/textutils_spec.lua b/projects/core/src/test/resources/test-rom/spec/apis/textutils_spec.lua
--- a/projects/core/src/test/resources/test-rom/spec/apis/textutils_spec.lua 2021-06-08 23:52:34.000000000 -0400
+++ b/projects/core/src/test/resources/test-rom/spec/apis/textutils_spec.lua 2021-04-28 03:19:00.000000000 -0400
@@ -84,7 +84,6 @@
describe("textutils.serialise", function()
it("serialises basic tables", function()
expect(textutils.serialise({ 1, 2, 3, a = 1, b = {} }))
- :eq("{\n 1,\n 2,\n 3,\n a = 1,\n b = {},\n}")

expect(textutils.serialise({ 0 / 0, 1 / 0, -1 / 0 }))
:eq("{\n 0/0,\n 1/0,\n -1/0,\n}")
@@ -117,7 +116,6 @@

it("can emit in a compact form", function()
expect(textutils.serialise({ 1, 2, 3, a = 1, [false] = {} }, { compact = true }))
- :eq("{1,2,3,a=1,[false]={},}")
end)

it("ignores metatables", function()
diff -ruN --strip -x .DS_Store projects/core/src/test/resources/test-rom/spec/lua/timeout_spec.lua b/projects/core/src/test/resources/test-rom/spec/lua/timeout_spec.lua
--- a/projects/core/src/test/resources/test-rom/spec/lua/timeout_spec.lua 2021-06-08 23:52:34.000000000 -0400
+++ b/projects/core/src/test/resources/test-rom/spec/lua/timeout_spec.lua 2021-04-28 03:19:00.000000000 -0400
Expand Down Expand Up @@ -422,30 +449,3 @@ diff -ruN --strip -x .DS_Store src/test/resources/test-rom/spec/apis/fs_spec.lua
- expect(#tbl):eq(len)
- end)
-end)
diff -ruN --strip -x .DS_Store projects/core/src/test/resources/test-rom/spec/apis/fs_spec.lua b/projects/core/src/test/resources/test-rom/spec/apis/fs_spec.lua
--- a/projects/core/src/test/resources/test-rom/spec/apis/textutils_spec.lua 2021-06-08 23:55:10.000000000 -0400
+++ b/projects/core/src/test/resources/test-rom/spec/apis/textutils_spec.lua 2021-06-08 22:55:10.000000000 -0400
@@ -64,11 +64,9 @@

describe("textutils.serialise", function()
it("serialises basic tables", function()
- expect(textutils.serialise({ 1, 2, 3, a = 1, b = {} }))
- :eq("{\n 1,\n 2,\n 3,\n a = 1,\n b = {},\n}")
+ textutils.serialise({ 1, 2, 3, a = 1, b = {} })

- expect(textutils.serialise({ 0 / 0, 1 / 0, -1 / 0 }))
- :eq("{\n 0/0,\n 1/0,\n -1/0,\n}")
+ textutils.serialise({ 0 / 0, 1 / 0, -1 / 0 })
end)

it("fails on recursive tables", function()
@@ -93,8 +92,7 @@
end)

it("can emit in a compact form", function()
- expect(textutils.serialise({ 1, 2, 3, a = 1, [false] = {} }, { compact = true }))
- :eq("{1,2,3,a=1,[false]={},}")
+ textutils.serialise({ 1, 2, 3, a = 1, [false] = {} }, { compact = true })
end)
end)

Loading

0 comments on commit 5cfd180

Please sign in to comment.