Skip to content

Commit 344c289

Browse files
committed
Restructure project
1 parent 789eab5 commit 344c289

File tree

129 files changed

+36
-24
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+36
-24
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,25 @@ jobs:
1414
uses: actions/checkout@v2
1515

1616
- name: Set up build environment
17+
working-directory: ./strongmod
1718
run: make setup-environment
1819

1920
- name: Download and unzip python
21+
working-directory: ./strongmod
2022
run: make download-and-unzip-cpython
2123

2224
- name: Compile project
25+
working-directory: ./strongmod
2326
run: make
2427

25-
- uses: montudor/action-zip@v1
26-
with:
27-
args: zip -qq -r strongmod.zip ./
28+
- name: Zip project
29+
working-directory: ./strongmod
30+
run: make zip-project
2831

2932
- uses: "marvinpinto/action-automatic-releases@latest"
3033
with:
3134
repo_token: "${{ secrets.GITHUB_TOKEN }}"
3235
prerelease: false
3336
files: |
34-
./strongmod.zip
37+
./strongmod/strongmod.zip
3538

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@
5050
/build/
5151
/game_controller.dll
5252
game_controller.o
53-
/docs/build/
54-
/strongmod/version.py
53+
/strongmod/docs/build/
54+
/strongmod/strongmod/version.py
55+
/strongmod/cpython

start_game.bat

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
start "" ".\python.exe" .\strongmod\start_game.py
1+
setlocal
2+
3+
.\strongmod\cpython\python.exe .\strongmod\strongmod\start_game.py
4+
5+
endlocal

strongmod/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
import sys
2-
sys.path.append('strongmod')
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/source/api.rst renamed to strongmod/docs/source/api.rst

Lines changed: 0 additions & 1 deletion
File renamed without changes.
File renamed without changes.

makefile renamed to strongmod/makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,16 @@ strongmod/version.py:
2323

2424
setup-environment:
2525
sudo apt-get update
26-
sudo apt-get install -y gcc-mingw-w64-i686 unzip
26+
sudo apt-get install -y gcc-mingw-w64-i686 unzip zip
2727

2828
download-and-unzip-cpython:
29-
wget https://www.python.org/ftp/python/3.8.10/python-3.8.10-embed-win32.zip
30-
unzip -n python-3.8.10-embed-win32.zip
31-
rm python-3.8.10-embed-win32.zip
29+
mkdir -p cpython
30+
wget https://www.python.org/ftp/python/3.8.10/python-3.8.10-embed-win32.zip -O cpython/python-3.8.10-embed-win32.zip
31+
unzip -n cpython/python-3.8.10-embed-win32.zip -d cpython/
32+
rm cpython/python-3.8.10-embed-win32.zip
33+
34+
zip-project:
35+
cd .. && zip -r ./strongmod/strongmod.zip ./strongmod ./start_game.bat
3236

3337
.PHONY: strongmod/version.py
3438

mods/auto_market/main.py renamed to strongmod/mods/auto_market/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
load_image = ui.load_image
99

10-
images_path = "./mods/auto_market/images"
10+
images_path = "./strongmod/mods/auto_market/images"
1111

1212
load_images = ui.load_images
1313

File renamed without changes.
File renamed without changes.
File renamed without changes.

strongmod/strongmod/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import os
2+
import sys
3+
sys.path.insert(0, os.path.abspath('./strongmod/strongmod'))
4+
File renamed without changes.
File renamed without changes.
File renamed without changes.

strongmod/api/lord.py renamed to strongmod/strongmod/api/lord.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,9 @@ def count_metal_armor(self):
336336
return count_metal_armor(self.lord_id)
337337

338338
def count_good(self, good_type: GoodType) -> int:
339-
"""
340-
Get the amount of a specific type of good owned by the lord.
341-
339+
"""Get the amount of a specific type of good owned by the lord.
342340
:param good_type: The type of the good.
343341
:type good_type: GoodType
344-
345342
:return: The amount of the specified good.
346343
:rtype int
347344
"""
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

strongmod/init.py renamed to strongmod/strongmod/init.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from internal.mod_repository import ModRepository, DirectoryManager
88
from common.file_system import FileSystem
99

10-
_game_controller = CDLL("game_controller.dll")
10+
_game_controller = CDLL("./strongmod/game_controller.dll")
1111

1212
entry = 0x0584026
1313
t = Thread(target=CFUNCTYPE(c_void_p)(entry))
@@ -24,5 +24,5 @@ def handle_ui_tick_event():
2424
file_manager = FileSystem()
2525

2626

27-
ModLoader(ModRepository("./mods", directory_manager, file_manager)).load_mods()
27+
ModLoader(ModRepository("./strongmod/mods", directory_manager, file_manager)).load_mods()
2828
t.join()

strongmod/internal/game_controller_maker.py renamed to strongmod/strongmod/internal/game_controller_maker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44
class GameControllerMaker:
55
def make_game_controller(self):
6-
return CDLL("./game_controller.dll")
6+
return CDLL("./strongmod/game_controller.dll")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

strongmod/start_game.py renamed to strongmod/strongmod/start_game.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import ctypes
2+
import os
23
import sys
34

4-
sys.path.append('strongmod')
5+
# sys.path.append('strongmod/strongmod')
6+
sys.path.insert(0, os.path.abspath('./strongmod/strongmod'))
57

68
from pymem import Pymem
79

@@ -64,4 +66,4 @@ def create_suspended_process(command_line):
6466
process = Pymem(process_id)
6567
process.inject_python_interpreter()
6668

67-
process.inject_python_shellcode("import strongmod.init")
69+
process.inject_python_shellcode("import sys;import os;sys.path.insert(0, os.path.abspath('./strongmod'));import strongmod.init")
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)