Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Win mac fixes #668

Merged
merged 16 commits into from
Feb 20, 2025
4 changes: 2 additions & 2 deletions .github/workflows/build-msys2-nonwizard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ jobs:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW32
release: false
update: false
install: git mingw-w64-i686-gcc make mingw-w64-i686-cmake mingw-w64-i686-libpng mingw-w64-i686-SDL2 mingw-w64-i686-SDL2_mixer
install: git mingw-w64-i686-gcc make mingw-w64-i686-cmake mingw-w64-i686-libpng mingw-w64-i686-SDL2 mingw-w64-i686-SDL2_mixer mingw-w64-i686-pcre
- name: CI-Build
run: |
cd D:/a/ivan/ivan
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build-msys2-wizmode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ jobs:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW32
release: false
update: false
install: git mingw-w64-i686-gcc make mingw-w64-i686-cmake mingw-w64-i686-libpng mingw-w64-i686-SDL2 mingw-w64-i686-SDL2_mixer
install: git mingw-w64-i686-gcc make mingw-w64-i686-cmake mingw-w64-i686-libpng mingw-w64-i686-SDL2 mingw-w64-i686-SDL2_mixer mingw-w64-i686-pcre
- name: Get tag name, print
shell: bash
run: |
Expand All @@ -39,10 +39,10 @@ jobs:

# Attention: you perform the release step when you push a tag, neat huh?
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ github.workspace }}\*.zip
files: ${{ github.workspace }}\IVAN-${{env.RELEASE_VERSION}}-win.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#GITHUB_REPOSITORY: attnam/ivan
2 changes: 1 addition & 1 deletion .github/workflows/build-osx-wizmode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
key="$(grep -o "'https://[^']*'" ci/osx/requirements.sh | openssl dgst -sha256 -hex)"
echo "CACHE_KEY=${key#* }" >> $GITHUB_ENV
- name: Reuse cached files
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/Thirdparty/Frameworks
Expand Down
2 changes: 1 addition & 1 deletion FeLib/Source/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void globalerrorhandler::Abort(cchar* Format, ...)

va_list AP;
va_start(AP, Format);
vsprintf(Buffer, Format, AP);
vsnprintf(Buffer, sizeof(Buffer), Format, AP);
va_end(AP);

strcat(Buffer, BugMsg);
Expand Down
4 changes: 2 additions & 2 deletions FeLib/Source/rawbit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ void rawbitmap::Printf(bitmap* Bitmap, v2 Pos, packcol16 Color, cchar* Format, .

va_list AP;
va_start(AP, Format);
vsprintf(Buffer, Format, AP);
vsnprintf(Buffer, sizeof(Buffer), Format, AP);
va_end(AP);

fontcache::const_iterator Iterator = FontCache.find(Color);
Expand Down Expand Up @@ -467,7 +467,7 @@ void rawbitmap::PrintfUnshaded(bitmap* Bitmap, v2 Pos, packcol16 Color, cchar* F

va_list AP;
va_start(AP, Format);
vsprintf(Buffer, Format, AP);
vsnprintf(Buffer, sizeof(Buffer), Format, AP);
va_end(AP);

fontcache::const_iterator Iterator = FontCache.find(Color);
Expand Down
2 changes: 1 addition & 1 deletion FeLib/Source/whandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ void ShowFPS(){ //TODO still flickers sometimes cuz of silhouette?
static v2 v2Margin(iMargin,iMargin);
static char c[100];

sprintf(c,"FPS:ls=%.1f,insta=%.1f",globalwindowhandler::GetFPS(false),globalwindowhandler::GetFPS(true));
snprintf(c, sizeof(c), "FPS:ls=%.1f,insta=%.1f", globalwindowhandler::GetFPS(false), globalwindowhandler::GetFPS(true));
int iDistX = strlen(c)*8 + 10 + 100; // +10 to look good, + 100 cuz of silhouette area
v2 v2Pos = RES-v2(iDistX,RES.Y)+v2Margin;
v2 v2Size(iDistX, 8+iMargin*2);
Expand Down
2 changes: 1 addition & 1 deletion Main/Source/cmdcraft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3057,7 +3057,7 @@ void updateCraftDesc(){
float fSkill=craftcore::CraftSkill(PLAYER); //TODO should this dynamic value show too where stats are?
festring fsSkill="Crafting Proficiency: "; // It's actually different from skills, so don't call it a skill.
static char cSkill[20];
sprintf(cSkill, "%.1f",fSkill);
snprintf(cSkill, sizeof(cSkill), "%.1f",fSkill);
fsSkill<<cSkill;

festring fsDesc=fsSkill;
Expand Down
4 changes: 2 additions & 2 deletions Main/Source/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ void game::InitScript()
for (int f = 0; f <= 99; f++) //additional dungeon files
{
char bnum[32];
sprintf(bnum, "Script/dungeon_%02d.dat", f);
snprintf(bnum, sizeof(bnum), "Script/dungeon_%02d.dat", f);
inputfile ifl(game::GetDataDir()+bnum, &game::GetGlobalValueMap(), false);
if (ifl.IsOpen())
{
Expand Down Expand Up @@ -5866,7 +5866,7 @@ truth game::ValidateCustomCmdKey(int iNewKey, int iIgnoreIndex, bool bMoveKeys)
festring IntToHexStr(int i)
{
static char hexbuf[100];
sprintf(hexbuf, "0x%04X", i);
snprintf(hexbuf, sizeof(hexbuf), "0x%04X", i);
festring fs;fs=hexbuf;
return fs;
}
Expand Down
2 changes: 1 addition & 1 deletion Main/Source/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ void item::AddInventoryEntry(ccharacter*, festring& Entry, int Amount, truth Sho
Entry << " " << GetVolume() * Amount << "cm3"; //the item can be seen therefore it's volume guessed already
if(GetSecondaryMaterial()==NULL){ //simple items like ingots sticks etc
static char density[20];
sprintf(density, "%.1f", GetWeight()/(float)GetVolume());
snprintf(density, sizeof(density), "%.1f", GetWeight()/(float)GetVolume());
Entry << " " << density << "g/cm3"; //the item can be seen and weighted already so this just helps avoiding having to mentally calc density for every item
if(game::WizardModeIsActive()) //TODO || Char-> possess item <materialmanual*>
Entry << " " << GetStrengthValue() << "str"; //this is special info tho.
Expand Down
2 changes: 1 addition & 1 deletion Main/Source/message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void msgsystem::AddMessage(cchar* Format, ...)

va_list AP;
va_start(AP, Format);
vsprintf(Message, Format, AP);
vsnprintf(Message, sizeof(Message), Format, AP);
va_end(AP);

festring Buffer(Message);
Expand Down
11 changes: 11 additions & 0 deletions ci/osx/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,18 @@ install_name_tool -change "${libpng}" @loader_path/../Frameworks/libpng.dylib "$
# zip -9 -r --symlinks "${ZIP_FILE}" "${GAME_DIR}"
#fi

# Workaround resource busy bug on github on MacOS 13
# https://github.com/actions/runner-images/issues/7522
# Reference to solution here: https://github.com/actions/runner-images/issues/7522#issuecomment-2530703890
# And actual code solution here: https://github.com/fredowski/osxbundler/commit/67d668c579d76426e780370eaf6d02858be89180
i=0
until
# for a compact dmg file
hdiutil create -fs HFSX -fsargs '-c c=64,a=16,e=16' \
-format UDZO -imagekey zlib-level=9 \
-volname "${FILENAME}" -srcfolder "${GAME_DIR}" "${DMG_FILE}"
do
if [ $i -eq 10 ]; then exit 1; fi
i=$((i+1))
sleep 1
done