# HG changeset patch # User unc0rr # Date 1352142212 -14400 # Node ID 644b757d20e6b1cfc0c454568dac837b5a66ccca # Parent 85b3970b402a42d944fa6072d6172018f626d073 Start work on physfs support in engine diff -r 85b3970b402a -r 644b757d20e6 hedgewars/CMakeLists.txt --- a/hedgewars/CMakeLists.txt Mon Nov 05 23:03:01 2012 +0400 +++ b/hedgewars/CMakeLists.txt Mon Nov 05 23:03:32 2012 +0400 @@ -54,6 +54,7 @@ uLocale.pas uMisc.pas uMobile.pas + uPhysFSLayer.pas uRandom.pas uRender.pas uRenderUtils.pas @@ -99,6 +100,9 @@ endif (APPLE) endif(BUILD_ENGINE_LIBRARY) +# doesn't work for some reason (doesn't find symbols) +#set(pascal_flags "-k${LIBRARY_OUTPUT_PATH}/libphysfs.a" ${pascal_flags}) + IF(FPC) set(fpc_executable ${FPC}) ELSE() diff -r 85b3970b402a -r 644b757d20e6 hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Mon Nov 05 23:03:01 2012 +0400 +++ b/hedgewars/hwengine.pas Mon Nov 05 23:03:32 2012 +0400 @@ -29,9 +29,10 @@ program hwengine; {$ENDIF} -uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uInputHandler, - uSound, uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uAILandMarks, uLandTexture, uCollisions, - SysUtils, uTypes, uVariables, uCommands, uUtils, uCaptions, uDebug, uCommandHandlers, uLandPainted +uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uInputHandler + , uSound, uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uAILandMarks, uLandTexture, uCollisions + , SysUtils, uTypes, uVariables, uCommands, uUtils, uCaptions, uDebug, uCommandHandlers, uLandPainted + , uPhysFSLayer {$IFDEF USE_VIDEO_RECORDING}, uVideoRec {$ENDIF} {$IFDEF USE_TOUCH_INTERFACE}, uTouch {$ENDIF} {$IFDEF ANDROID}, GLUnit{$ENDIF} @@ -459,6 +460,7 @@ if complete then begin + uPhysFSLayer.initModule; {$IFDEF ANDROID}GLUnit.initModule;{$ENDIF} {$IFDEF USE_TOUCH_INTERFACE}uTouch.initModule;{$ENDIF} {$IFDEF USE_VIDEO_RECORDING}uVideoRec.initModule;{$ENDIF} //stub @@ -510,6 +512,7 @@ {$IFDEF USE_VIDEO_RECORDING}uVideoRec.freeModule;{$ENDIF} {$IFDEF USE_TOUCH_INTERFACE}uTouch.freeModule;{$ENDIF} //stub {$IFDEF ANDROID}GLUnit.freeModule;{$ENDIF} + uPhysFSLayer.freeModule; end; uIO.freeModule; diff -r 85b3970b402a -r 644b757d20e6 hedgewars/uPhysFSLayer.pas --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hedgewars/uPhysFSLayer.pas Mon Nov 05 23:03:32 2012 +0400 @@ -0,0 +1,28 @@ +unit uPhysFSLayer; + +{$LINKLIB ../bin/libphysfs.a} + +interface + +procedure initModule; +procedure freeModule; + +implementation +uses uUtils; + +function PHYSFS_init(argv0: PChar) : LongInt; cdecl; external; +function PHYSFS_deinit() : LongInt; cdecl; external; + +function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool); cdecl; external; + +procedure initModule; +begin + PHYSFS_init(Str2PChar(ParamStr(0))); +end; + +procedure freeModule; +begin + PHYSFS_deinit; +end; + +end.