From 7e50a72e284c48912037893c6ef6be514dc0920f Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Wed, 9 Mar 2011 16:02:06 +0000 Subject: [PATCH] plop git-svn-id: http://svn.net-core.org/repos/t-engine4@2989 51575b47-30f0-44d4-a5cc-537603b46e54 --- premake4.lua | 13 +++++++------ src/runner/main.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/premake4.lua b/premake4.lua index 0d760ae85e..e5af862336 100644 --- a/premake4.lua +++ b/premake4.lua @@ -91,18 +91,19 @@ project "TEngineRunner" kind "WindowedApp" language "C" targetname "t-engine" - files { "src/runner/*.c", } - links { "dl" } -configuration {"linux", "Debug"} - postbuildcommands { "cp bin/Debug/t-engine t-engine", } -configuration {"linux", "Release"} - postbuildcommands { "cp bin/Release/t-engine t-engine", } + files { "src/runner/*.c", "src/getself.c" } + links { "physfs", "lua".._OPTIONS.lua } configuration "linux" + links { "dl" } defines { 'SELFEXE_LINUX' } configuration "windows" defines { 'SELFEXE_WINDOWS' } configuration "macosx" defines { "USE_TENGINE_MAIN", 'SELFEXE_MACOSX' } +configuration {"Debug"} + postbuildcommands { "cp bin/Debug/t-engine t-engine", } +configuration {"Release"} + postbuildcommands { "cp bin/Release/t-engine t-engine", } project "TEngine" targetprefix "" diff --git a/src/runner/main.c b/src/runner/main.c index 2374d0ec0e..f19ba5ccff 100644 --- a/src/runner/main.c +++ b/src/runner/main.c @@ -1,3 +1,24 @@ +/* + TE4 - T-Engine 4 + Copyright (C) 2009, 2010 Nicolas Casalini + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + Nicolas Casalini "DarkGod" + darkgod@te4.org +*/ + #include <stdio.h> #include <stdlib.h> @@ -7,6 +28,8 @@ #include <dlfcn.h> #endif +#include "physfs.h" + // Load the shared lib containing the core and calls te4main inside it, passing control to that core int run_core(int corenum, int argc, char **argv) { @@ -83,6 +106,22 @@ int main(int argc, char **argv) { int core = 12; + /***************** Physfs Init *****************/ + PHYSFS_init(argv[0]); + + const char *selfexe = get_self_executable(argc, argv); + if (selfexe) + { + PHYSFS_mount(selfexe, "/", 1); + } + else + { + printf("NO SELFEXE: bootstrapping from CWD\n"); + PHYSFS_mount("bootstrap", "/bootstrap", 1); + } + + PHYSFS_deinit(); + // Run the requested cores until we want no more while (core) core = run_core(core, argc, argv); -- GitLab