Skip to content

Commit

Permalink
Linux/gcc fixes and improvements:
Browse files Browse the repository at this point in the history
- Core.h: disabled HAS_UI for linux
- TStaticArray wasn't compilable with gcc (requires 'using' for parent's fields)
- main.cpp: removed 'goto bad_params', replaced with CommandLineError()
- make: using 4 threads
- test.sh: support for Windows game paths on Linux



git-svn-id: svn://localhost@221 a3f5f06f-15b6-264c-8744-b656ee826ca1
  • Loading branch information
gildor2 committed Sep 19, 2014
1 parent 37436e8 commit b801fe2
Show file tree
Hide file tree
Showing 11 changed files with 205 additions and 80 deletions.
7 changes: 4 additions & 3 deletions Core/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ typedef unsigned __int64 uint64;
# define GCC_PACK __attribute__((__packed__))
# undef VSTUDIO_INTEGRATION
# undef WIN32_USE_SEH
# undef HAS_UI // not yet supported on this platform
typedef signed long long int64;
typedef unsigned long long uint64;
#else
Expand Down Expand Up @@ -443,10 +444,10 @@ void appDumpStackTrace(const address_t* buffer, int depth);

#else

inline appInitPlatform() {}
inline void appInitPlatform() {}

int appCaptureStackTrace(address_t* buffer, int maxDepth, int framesToSkip) {}
void appDumpStackTrace(const address_t* buffer, int depth) {}
inline int appCaptureStackTrace(address_t* buffer, int maxDepth, int framesToSkip) {}
inline void appDumpStackTrace(const address_t* buffer, int depth) {}

#endif // _WIN32

Expand Down
2 changes: 2 additions & 0 deletions Core/GlWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1502,7 +1502,9 @@ void VisualizerLoop(const char *caption, CApplication *App)

SDL_Window* CApplication::GetWindow() const
{
#if NEW_SDL
return sdlWindow;
#endif
}

#endif // RENDERING
2 changes: 2 additions & 0 deletions Core/GlWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "Core.h"

struct SDL_Window;

/*-----------------------------------------------------------------------------
Control functions
-----------------------------------------------------------------------------*/
Expand Down
31 changes: 19 additions & 12 deletions Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,20 @@ static void SetPathOption(FString& where, const char* value)
where = buffer;
}

// Display error message about wrong command line and then exit.
static void CommandLineError(const char *fmt, ...)
{
va_list argptr;
va_start(argptr, fmt);
char buf[4096];
int len = vsnprintf(ARRAY_ARG(buf), fmt, argptr);
va_end(argptr);
if (len < 0 || len >= sizeof(buf) - 1) exit(1);

appPrintf("%s\nTry \"umodel -help\" for more information.\n", buf);
exit(1);
}


#define OPT_BOOL(name,var) { name, (byte*)&var, true },
#define OPT_NBOOL(name,var) { name, (byte*)&var, false },
Expand Down Expand Up @@ -1051,8 +1065,7 @@ int main(int argc, char **argv)
}
else
{
appPrintf("COMMAND LINE ERROR: unknown option: %s\n", argv[arg]);
goto bad_params;
CommandLineError("umodel: invalid option: %s", opt);
}
}

Expand All @@ -1061,10 +1074,8 @@ int main(int argc, char **argv)
const char *argClassName = (params.Num() >= 3) ? params[2] : NULL;
if (params.Num() > 3)
{
appPrintf("COMMAND LINE ERROR: too many arguments. Check your command line.\nYou specified: package=%s, object=%s, class=%s\n", argPkgName, argObjName, argClassName);
bad_params:
appPrintf("Use \"umodel\" without arguments to show command line help\n");;
exit(1);
CommandLineError("umodel: too many arguments, please check your command line.\nYou specified: package=%s, object=%s, class=%s",
argPkgName, argObjName, argClassName);
}

bool guiShown = false;
Expand Down Expand Up @@ -1097,13 +1108,9 @@ int main(int argc, char **argv)
TArray<UObject*> Objects;

#if !HAS_UI
if (!argPkgName) goto bad_pkg_name;

if (!params.Num())
if (!argPkgName || !params.Num())
{
bad_pkg_name:
appPrintf("COMMAND LINE ERROR: package name is not specified\n");
goto bad_params;
CommandLineError("umodel: package name was not specified.");
}
#else
if (!argPkgName)
Expand Down
6 changes: 6 additions & 0 deletions Tools/CompatTable/table.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ Lionhead Studios
http://en.wikipedia.org/wiki/Fable_Anniversary#Fable_Anniversary
http://www.gildor.org/smf/index.php/topic,2178.0.html

[Goat Simulator]
Y Y Y Y ?
Coffee Stain Studios
http://en.wikipedia.org/wiki/Goat_Simulator
http://www.gildor.org/smf/index.php/topic,2482.0.html

[Godfire]
Y Y Y Y 867.0
Vivid Games
Expand Down
4 changes: 4 additions & 0 deletions UI/BaseDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class UIElement
FORCEINLINE int GetWidth() const { return Width; }
FORCEINLINE int GetHeight() const { return Height; }

//!! add SetFontHeight(int)

static FORCEINLINE int EncodeWidth(float w)
{
w = bound(w, 0, 1);
Expand Down Expand Up @@ -92,6 +94,8 @@ class UIElement
HWND Wnd;
int Id;

//!! pass 'inout HWND* wnd' here, don't create a window when already created - but update window position
//!! instead (that's for resizing capabilities)
HWND Window(const char* className, const char* text, DWORD style, DWORD exstyle, UIBaseDialog* dialog,
int id = -1, int x = -1, int y = -1, int w = -1, int h = -1);

Expand Down
6 changes: 6 additions & 0 deletions Unreal/UnCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,12 @@ template<class T> class TArray : public FArray
// Binary-compatible array, but with no allocations inside
template<class T, int N> class TStaticArray : public TArray<T>
{
// We require "using TArray<T>::*" for gcc 3.4+ compilation
// http://gcc.gnu.org/gcc-3.4/changes.html
// - look for "unqualified names"
// - "temp.dep/3" section of the C++ standard [ISO/IEC 14882:2003]
using TArray<T>::DataPtr;
using TArray<T>::MaxCount;
public:
FORCEINLINE TStaticArray()
{
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ case "$PLATFORM" in
gccfilt make -f $makefile
;;
"linux")
make -f $makefile
make -j 4 -f $makefile # use 4 jobs for build
;;
*)
echo "Unknown PLATFORM=\"$PLATFORM\""
Expand Down
Loading

0 comments on commit b801fe2

Please sign in to comment.