Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "minparse"]
path = minparse
url = https://github.com/Josh194/ArgParse
[submodule "zydis"]
path = zydis
url = https://github.com/zyantific/zydis.git
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 3.19)

if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Do not build in source")
endif()

project(FMCB)

include(CheckIPOSupported)
Expand All @@ -8,9 +12,14 @@ check_ipo_supported()
# maybe error check to insure version was found
file(READ info.json INFO_JSON)
string(JSON VERSION GET "${INFO_JSON}" version)

message("Server version is ${VERSION}")

set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install) # Should this be in /bin?
message("Install location is \"${CMAKE_INSTALL_PREFIX}\"")

set(GRAPHVIZ_GENERATE_PER_TARGET false)
set(GRAPHVIZ_GENERATE_DEPENDERS false)

set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo" CACHE STRING "")

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Expand Down
15 changes: 15 additions & 0 deletions Factorio/FMCB/control.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
script.on_event({defines.events.on_tick},
function (e)
if e.tick == 0 then
game.print("FMCB has been correctly loaded")
game.print(fmcb.int_cube(4))

-- local chest_inventory = entity.get_inventory(1)
-- local item = "coal"

-- for s = 1, 2 do
-- chest_inventory[s].set_stack{name = item, count = game.item_prototypes[item].stack_size}
-- end
end
end
)
4 changes: 4 additions & 0 deletions Factorio/FMCB/data.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fmcb = require("libFMCBLua")

require("prototypes.genericSend")
require("prototypes.genericSend")
6 changes: 3 additions & 3 deletions Factorio/FMCB_0.0.1/info.json → Factorio/FMCB/info.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "FMCB",
"version": "0.0.1",
"version": "0.1.0",
"title": "FMCB",
"author": "MegaGlub & the4naves",
"contact": "",
"homepage": "https://github.com/Josh194/FMCB",
"factorio_version": "0.17",
"dependencies": [ "base >= 0.17" ],
"factorio_version": "1.1",
"dependencies": [],
"description": "Adds the factorio FMCB subsystem."
}
Empty file.
18 changes: 0 additions & 18 deletions Factorio/FMCB_0.0.1/Bridge.cpp

This file was deleted.

14 changes: 0 additions & 14 deletions Factorio/FMCB_0.0.1/control.lua

This file was deleted.

2 changes: 0 additions & 2 deletions Factorio/FMCB_0.0.1/data.lua

This file was deleted.

15 changes: 0 additions & 15 deletions Factorio/FMCB_0.0.1/prototypes/genericSend.lua

This file was deleted.

12 changes: 12 additions & 0 deletions client/wrapper/Lua/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
find_package(Lua)
include_directories(${LUA_INCLUDE_DIR})

add_library(LuaWrapperDef SHARED Memory.c)

target_link_libraries(LuaWrapperDef ClientCore ${LUA_LIBRARIES})

set_target_properties(LuaWrapperDef PROPERTIES OUTPUT_NAME "FMCBLua") # Can this be placed in add_library?

install(TARGETS LuaWrapperDef)

# Should we create some kind of lua archive?
11 changes: 11 additions & 0 deletions client/wrapper/Lua/FMCB.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
arr = {2, 5, 6}

function printAll()
for i = 1, 3 do
print(arr[i])
end
end

test = require("libFMCBLua")
print(test.int_cube(3))
printAll()
21 changes: 21 additions & 0 deletions client/wrapper/Lua/Memory.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "Memory.h"
#include "lauxlib.h"

static int iCube(lua_State *L) {
int x = luaL_checknumber(L, 1);

lua_pushnumber(L, x * x * x);

return 1; // Number of return values
}

static const luaL_Reg fmcbReg[] = {
{"int_cube", iCube},
{NULL, NULL}
};

LUALIB_API int luaopen_libFMCBLua(lua_State *L) {
luaL_newlib(L, fmcbReg); // ? Is this correct?

return 1; // ? What does Lua expect here?
}
4 changes: 4 additions & 0 deletions client/wrapper/Lua/Memory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// ? (C++) Could we just use C instead? The API is designed for it after all.
#include "lua.h"

LUALIB_API int luaopen_libFMCBLua(lua_State *L); // ? (C++) Should this be in a namespace?
1 change: 1 addition & 0 deletions zydis
Submodule zydis added at 25193d