Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
58ce346
kauai/test: always include gtest/gtest.h before util.h
mcayland Nov 24, 2025
8c7dbde
kauai/src/platform.h: add GetEnvironmentVariable() platform function …
mcayland Nov 24, 2025
6bd3074
kauai/src/appbsdl.cpp: don't include unused io.h header file
mcayland Nov 24, 2025
646bb6b
kauai/CMakeLists.txt: add missing dependencies for KauaiGuiTest
mcayland Nov 24, 2025
bd0bac7
bren/stdmem.c: rename to stdmemwin.cpp and include only for Windows p…
mcayland Nov 24, 2025
597d88b
src/engine/body.cpp: replace UCHAR type with cstdint uint8_t type
mcayland Nov 24, 2025
53f9197
src/engine/msnd.cpp: restrict WORD constants to the Windows platform
mcayland Nov 24, 2025
1bbcd38
inc/soc.h: replace MacWin() macro usage
mcayland Nov 24, 2025
cbb10ec
inc/utest.h: replace DWORD type with cstdint uint32_t type
mcayland Nov 24, 2025
3b36ceb
src/studio/stdiobrw.cpp: replace BOOL type with cstdint bool type
mcayland Nov 24, 2025
fd8a948
src/studio/utest.cpp: use standard C++ try/catch in APP::Run() for no…
mcayland Nov 24, 2025
b377565
src/studio/utest.cpp: move DWORD declarations inside #ifdef WIN32
mcayland Nov 24, 2025
8db0d5d
src/studio/configstub.cpp: use string constants instead of integers f…
mcayland Nov 24, 2025
72d7fe4
bren/tmap.cpp: use Windows platform TMAP::PtmapReadNative() except on…
mcayland Nov 24, 2025
ac53985
bren/tmap.cpp: replace BYTE type with cstdint uint8_t type
mcayland Nov 24, 2025
8aaa686
kauai/src/utilstr.cpp: implement STN::GetUtf8Sz() and STN::SetUtf8Sz(…
mcayland Nov 24, 2025
7c78003
kauai/src/utilstr.cpp: implement FcmpCompareUserRgch() for non-Window…
mcayland Nov 24, 2025
0d66758
kauai/src/platform.h: add GetUserName() platform function for non-Win…
mcayland Nov 24, 2025
158191e
src/studio/utest.cpp: implement APP::_FGetUserName() for non-Windows …
mcayland Nov 24, 2025
d972259
kauai/src/fni.h: add new FNI::FIsReadOnly() method
mcayland Nov 24, 2025
2df4882
src/engine/movie.cpp: use FNI::FIsReadOnly() in MVIE::_FSetPfilSave()
mcayland Nov 24, 2025
4bf8814
CMakePresets.json: add sdl-x86_64-gcc-linux-debug and sdl-x86_64-gcc-…
mcayland Nov 24, 2025
ce570f9
.github/workflows/build.yml: add Linux gcc x86_64 Debug build
mcayland Nov 24, 2025
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
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,38 @@ jobs:
name: 3DMMEx Windows x64
path: |
dist/x64-clangcl-relwithdebinfo

compile-gcc-x86_64-linux-release:
name: Linux gcc x86_64 Debug
runs-on: ubuntu-latest
steps:
- name: Install Packages
run: |
sudo apt-get update &&
sudo apt-get install -y g++ cmake libsdl2-dev libsdl2-ttf-dev libgtk-3-dev zenity ninja-build
- name: Check out repository code
uses: actions/checkout@v4
- name: CMake Generate
run: |
cmake --preset sdl-x86_64-gcc-linux-debug
- name: CMake Build
run: |
cmake --build build/sdl-x86_64-gcc-linux-debug --target tools studio tests
- name: Run tests
run: |
ctest --test-dir build/sdl-x86_64-gcc-linux-debug --output-on-failure --timeout 60
- name: CMake Install
run: |
cmake --install build/sdl-x86_64-gcc-linux-debug --prefix dist/sdl-x86_64-gcc-linux-debug
- name: Upload debug files
uses: actions/upload-artifact@v4
with:
name: 3DMMEx Linux gcc x86_64 debug files
path: |
build/sdl-x86_64-gcc-linux-debug/src/chomp/studio/*.i
- name: Upload Debug
uses: actions/upload-artifact@v4
with:
name: 3DMMEx Linux gcc x86_64 Debug
path: |
dist/sdl-x86_64-gcc-linux-debug
20 changes: 19 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,24 @@
"CMAKE_BUILD_TYPE": "Debug",
"3DMM_GUI": "SDL"
}
},
{
"displayName": "SDL Linux gcc x64_64 Debug",
"name": "sdl-x86_64-gcc-linux-debug",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"3DMM_GUI": "SDL"
}
},
{
"displayName": "SDL Linux gcc x64_64 Release",
"name": "sdl-x86_64-gcc-linux-release",
"inherits": "base",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"3DMM_GUI": "SDL"
}
}
]
}
}
File renamed without changes.
8 changes: 3 additions & 5 deletions bren/tmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ bool TMAP::FWrite(PBLCK pblck)
return fTrue;
}

#ifdef WIN
#ifndef MAC

#define CALCDIST(bRed1, bGreen1, bBlue1, bRed2, bGreen2, bBlue2) \
(((bRed1) - (bRed2)) * ((bRed1) - (bRed2)) + ((bGreen1) - (bGreen2)) * ((bGreen1) - (bGreen2)) + \
Expand Down Expand Up @@ -255,7 +255,7 @@ PTMAP TMAP::PtmapReadNative(FNI *pfni, PGL pglclr)
pglCache->Put(prgb[iprgb], &iclrBest);
}

prgb[iprgb] = (BYTE)iclrBest;
prgb[iprgb] = (uint8_t)iclrBest;
}
}

Expand All @@ -269,9 +269,7 @@ PTMAP TMAP::PtmapReadNative(FNI *pfni, PGL pglclr)

return ptmap;
}
#endif // WIN

#ifdef MAC
#else // !MAC
PTMAP TMAP::PtmapReadNative(FNI *pfni)
{
RawRtn(); // REVIEW peted: NYI
Expand Down
18 changes: 13 additions & 5 deletions inc/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,19 @@
#define khidMsqClock khidLimKidFrame + 4
// khidStudio khidLimKidFrame + 5 Defined in stdiodef.h

#define kftgChunky MacWin(KLCONST4('c', 'h', 'n', 'k'), KLCONST3('c', 'h', 'k'))
#define kftgContent MacWin(KLCONST4('3', 'c', 'o', 'n'), KLCONST3('3', 'c', 'n'))
#define kftgThumbDesc MacWin(KLCONST4('3', 't', 'h', 'd'), KLCONST3('3', 't', 'h'))
#define kftg3mm MacWin(KLCONST3('3', 'm', 'm'), KLCONST3('3', 'm', 'm'))
#define kftgSocTemp MacWin(KLCONST4('3', 't', 'm', 'p'), KLCONST3('3', 't', 'p'))
#ifdef MAC
#define kftgChunky KLCONST4('c', 'h', 'n', 'k')
#define kftgContent KLCONST4('3', 'c', 'o', 'n')
#define kftgThumbDesc KLCONST4('3', 't', 'h', 'd')
#define kftg3mm KLCONST3('3', 'm', 'm')
#define kftgSocTemp KLCONST4('3', 't', 'm', 'p')
#else
#define kftgChunky KLCONST3('c', 'h', 'k')
#define kftgContent KLCONST3('3', 'c', 'n')
#define kftgThumbDesc KLCONST3('3', 't', 'h')
#define kftg3mm KLCONST3('3', 'm', 'm')
#define kftgSocTemp KLCONST3('3', 't', 'p')
#endif

#define ksz3mm PszLit("3mm")

Expand Down
2 changes: 1 addition & 1 deletion inc/utest.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class APP : public APP_PAR
bool _FInitBuilding(void);
bool _FInitStudio(PFNI pfniUserDoc, bool fFailIfDocOpenFailed = fTrue);
bool _FInitAcceleratorTable(void);
void _GetWindowProps(int32_t *pxp, int32_t *pyp, int32_t *pdxp, int32_t *pdyp, DWORD *pdwStyle);
void _GetWindowProps(int32_t *pxp, int32_t *pyp, int32_t *pdxp, int32_t *pdyp, uint32_t *pdwStyle);
void _RebuildMainWindow(void);
bool _FSwitch640480(bool fTo640480);
bool _FDisplayIs640480(void);
Expand Down
3 changes: 3 additions & 0 deletions kauai/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,10 @@ if (BUILD_TESTS)
target_link_libraries(
KauaiGuiTest
PUBLIC
KauaiBase
KauaiFile
KauaiTestLib
KauaiGroup
KauaiGui
KauaiRichText
GTest::gtest_main
Expand Down
3 changes: 1 addition & 2 deletions kauai/src/appbsdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "frame.h"
#include "fcntl.h"
#include "stdio.h"
#include "io.h"

ASSERTNAME

Expand Down Expand Up @@ -837,4 +836,4 @@ int32_t APPB::Win32VkFromVk(int32_t vk)
}

return vk;
}
}
1 change: 1 addition & 0 deletions kauai/src/fni.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class FNI : public FNI_PAR

tribool TExists(void);
bool FDelete(void);
bool FIsReadOnly(void);
bool FRename(PFNI pfniNew);
bool FEqual(PFNI pfni);

Expand Down
17 changes: 14 additions & 3 deletions kauai/src/fniposix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,17 +429,28 @@ bool FNI::FDelete(void)
return fFalse;
}

/***************************************************************************
Return whether the fni is read-only.
***************************************************************************/
bool FNI::FIsReadOnly(void)
{
AssertThis(ffniFile);
fs::perms perms;

perms = fs::status(_stnFile.Psz()).permissions();

return ((perms & fs::perms::owner_write) == fs::perms::none);
}

/***************************************************************************
Renames the file indicated by this to *pfni.
***************************************************************************/
bool FNI::FRename(FNI *pfni)
{
AssertThis(ffniFile);
AssertPo(pfni, ffniFile);
fs::perms perms;

perms = fs::status(_stnFile.Psz()).permissions();
if (!((perms & fs::perms::owner_write) == fs::perms::none))
if (!FIsReadOnly())
{
fs::path src = fs::path(_stnFile.Psz());
fs::path dst = fs::path(pfni->_stnFile.Psz());
Expand Down
13 changes: 11 additions & 2 deletions kauai/src/fniwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,16 @@ bool FNI::FDelete(void)
return fFalse;
}

/***************************************************************************
Return whether the fni is read-only.
***************************************************************************/
bool FNI::FIsReadOnly(void)
{
AssertThis(ffniFile);

return (FILE_ATTRIBUTE_READONLY & GetFileAttributes(_stnFile.Psz()));
}

/***************************************************************************
Renames the file indicated by this to *pfni.
***************************************************************************/
Expand All @@ -535,8 +545,7 @@ bool FNI::FRename(FNI *pfni)
AssertThis(ffniFile);
AssertPo(pfni, ffniFile);

if (!(FILE_ATTRIBUTE_READONLY & GetFileAttributes(_stnFile.Psz())) &&
MoveFile(_stnFile.Psz(), pfni->_stnFile.Psz()))
if (!FIsReadOnly() && MoveFile(_stnFile.Psz(), pfni->_stnFile.Psz()))
{
return fTrue;
}
Expand Down
10 changes: 10 additions & 0 deletions kauai/src/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ extern uint32_t DtsCaret(void);
Current executable name
****************************************/
extern void GetExecutableName(char *psz, int cchMax);

/****************************************
Get environment variable
****************************************/
extern uint32_t GetEnvironmentVariable(const char *pcszName, char *pszValue, uint32_t cchMax);

/****************************************
Current username
****************************************/
extern bool GetUserName(char *psz, int cchMax);
#endif

#endif //! PLATFORM_H
41 changes: 41 additions & 0 deletions kauai/src/platlinux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "platform.h"
#include <cstdlib>
#include <cstring>
#include <stdint.h>
#include <pthread.h>
#include <signal.h>
Expand Down Expand Up @@ -98,3 +99,43 @@ void GetExecutableName(char *psz, int cchMax)
len = ::readlink("/proc/self/exe", psz, cchMax - 1);
psz[len] = '\0';
}

/****************************************
Get environment variable
****************************************/
uint32_t GetEnvironmentVariable(const char *pcszName, char *pszValue, uint32_t cchMax)
{
char *psz = getenv(pcszName);
size_t ilen;

if (psz == NULL)
{
return 0;
}

ilen = strlen(psz);
if (ilen > cchMax)
{
ilen = cchMax;
}

memcpy(pszValue, psz, ilen);
pszValue[ilen] = '\0';
return ilen;
Comment thread
mcayland marked this conversation as resolved.
}

/****************************************
Current username
****************************************/
bool GetUserName(char *psz, int cchMax)
{
int ires;

ires = getlogin_r(psz, cchMax);
if (ires != 0)
{
return false;
}

return true;
}
Loading