-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix asset extraction bugs. Build script, handle bundle paths. Bump to…
… alpha 0.01a
- Loading branch information
Showing
11 changed files
with
142 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@echo off | ||
set NAME=farmvillagers_0.01a | ||
|
||
REM remember to activate the venv first (Scripts\activate) | ||
|
||
:main | ||
call :pyInstaller | ||
echo. | ||
pause>NUL | ||
exit | ||
|
||
:pyInstaller | ||
echo [+] Starting pyInstaller... | ||
pyinstaller ^ | ||
--onedir ^ | ||
--console ^ | ||
--noupx ^ | ||
--noconfirm ^ | ||
--paths ..\. ^ | ||
--add-data "..\\..\\patched;patched" ^ | ||
--add-data "..\\..\\templates;templates" ^ | ||
--add-data "..\\..\\villages;villages" ^ | ||
--add-data "..\\..\\xml;xml" ^ | ||
--add-data "..\\..\\embeds;embeds" ^ | ||
--add-data "..\\..\\assethash;assethash" ^ | ||
--workpath ".\\work" ^ | ||
--distpath ".\\dist" ^ | ||
--specpath ".\\spec" ^ | ||
--contents-directory "bundle" ^ | ||
--hidden-import cpyamf ^ | ||
--hidden-import pyamf.amf0 ^ | ||
--hidden-import pyamf.amf3 ^ | ||
--icon=..\icon.ico ^ | ||
--name %NAME% ..\server.py | ||
echo [+] pyInstaller Done. | ||
EXIT /B 0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,37 @@ | ||
import sys | ||
import os | ||
|
||
# Bundled data (extracted to a temp dir) | ||
|
||
TMP_BUNDLED_DIR = sys._MEIPASS if getattr(sys, 'frozen', None) else "." | ||
BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
TMP_BUNDLED_DIR = BASE_DIR | ||
|
||
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'): | ||
print(" [+] Running in bundle/packaged mode") | ||
TMP_BUNDLED_DIR = sys._MEIPASS | ||
# PyInstaller broke the __file__ attribute of the entry-point script which | ||
# used to point to the basename (where the EXE was located). Now it points | ||
# to the module's full path within the bundle directory. We need to point | ||
# it to the parent directory of the bundle, not the bundle itself. | ||
# Source: https://pyinstaller.org/en/stable/runtime-information.html | ||
# This change is relevant because Flask uses the __file__ attribute to find | ||
# the root directory of the application, and thus assets returned by functions | ||
# such as send_from_directory would include the bundle (or _internal) path. | ||
# We'll set Flask app.root_path to BASE_DIR instead of the default __file__ value | ||
# as a workaround. | ||
BASE_DIR = os.path.dirname(BASE_DIR) | ||
|
||
# Bundled data (extracted to a temp dir) | ||
|
||
ASSETS_DIR = os.path.join(TMP_BUNDLED_DIR, "assets") | ||
INNER_ASSETS_DIR = os.path.join(ASSETS_DIR, "zynga1-a.akamaihd.net/farmville/assets/hashed/assets") | ||
EMBEDS_DIR = os.path.join(TMP_BUNDLED_DIR, "embeds") | ||
ASSETHASH_DIR = os.path.join(TMP_BUNDLED_DIR, "assethash") | ||
STUB_ASSETS_DIR = os.path.join(TMP_BUNDLED_DIR, "stub") | ||
PATCHED_ASSETS_DIR = os.path.join(TMP_BUNDLED_DIR, "patched") | ||
TEMPLATES_DIR = os.path.join(TMP_BUNDLED_DIR, "templates") | ||
XML_DIR = os.path.join(TMP_BUNDLED_DIR, "xml") | ||
VILLAGES_DIR = os.path.join(TMP_BUNDLED_DIR, "villages") | ||
CACHE_DIR = os.path.join(TMP_BUNDLED_DIR, "cache") | ||
XML_DIR = os.path.join(TMP_BUNDLED_DIR, "xml") | ||
EMBEDS_DIR = os.path.join(TMP_BUNDLED_DIR, "embeds") | ||
ASSETHASH_DIR = os.path.join(TMP_BUNDLED_DIR, "assethash") | ||
|
||
# Not bundled data (next to server EXE) | ||
|
||
BASE_DIR = "." | ||
|
||
SAVES_DIR = os.path.join(BASE_DIR, "saves") | ||
ASSETS_DIR = os.path.join(BASE_DIR, "assets") | ||
CACHE_DIR = os.path.join(BASE_DIR, "cache") | ||
TMP_DIR = os.path.join(BASE_DIR, "tmp") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
requests==2.28.1 | ||
Flask==2.1.2 | ||
Py3AMF==0.8.10 | ||
tqdm==4.66.5 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters