hedgewars/uLocale.pas
changeset 11790 ac93cfc17365
parent 11684 cfc3971de8ac
child 11802 975c130c3901
equal deleted inserted replaced
11789:e2de320aaf69 11790:ac93cfc17365
    28 function  Format(fmt: shortstring; var arg: shortstring): shortstring;
    28 function  Format(fmt: shortstring; var arg: shortstring): shortstring;
    29 function  FormatA(fmt: ansistring; var arg: ansistring): ansistring;
    29 function  FormatA(fmt: ansistring; var arg: ansistring): ansistring;
    30 function  GetEventString(e: TEventId): ansistring;
    30 function  GetEventString(e: TEventId): ansistring;
    31 
    31 
    32 {$IFDEF HWLIBRARY}
    32 {$IFDEF HWLIBRARY}
    33 procedure LoadLocaleWrapper(path: pchar; filename: pchar); cdecl; export;
    33 procedure LoadLocaleWrapper(path: pchar; userpath: pchar; filename: pchar); cdecl; export;
    34 {$ENDIF}
    34 {$ENDIF}
    35 
    35 
    36 implementation
    36 implementation
    37 uses uRandom, uUtils, uVariables, uDebug, uPhysFSLayer;
    37 uses uRandom, uUtils, uVariables, uDebug, uPhysFSLayer;
    38 
    38 
   132 else
   132 else
   133     FormatA:= copy(fmt, 1, i - 1) + arg + FormatA(copy(fmt, i + 2, Length(fmt) - i - 1), arg)
   133     FormatA:= copy(fmt, 1, i - 1) + arg + FormatA(copy(fmt, i + 2, Length(fmt) - i - 1), arg)
   134 end;
   134 end;
   135 
   135 
   136 {$IFDEF HWLIBRARY}
   136 {$IFDEF HWLIBRARY}
   137 procedure LoadLocaleWrapper(path: pchar; filename: pchar); cdecl; export;
   137 procedure LoadLocaleWrapper(path: pchar; userpath: pchar; filename: pchar); cdecl; export;
   138 begin
   138 begin
   139     PathPrefix := Strpas(path);
   139     PathPrefix := Strpas(path);
       
   140     UserPathPrefix := Strpas(userpath);
   140  
   141  
   141     uUtils.initModule(false);
   142     //normally this var set in preInit of engine
   142     uVariables.initModule;
   143     allOK := true;
   143 
   144     
   144     PathPrefix:= PathPrefix + #0;
   145     PathPrefix:= PathPrefix + #0;
   145     UserPathPrefix:= UserPathPrefix + #0;
   146     UserPathPrefix:= UserPathPrefix + #0;
   146     uPhysFSLayer.initModule(@PathPrefix[1], @UserPathPrefix[1]);
   147     uPhysFSLayer.initModule(@PathPrefix[1], @UserPathPrefix[1]);
   147     PathPrefix:= copy(PathPrefix, 1, length(PathPrefix) - 1);
   148     PathPrefix:= copy(PathPrefix, 1, length(PathPrefix) - 1);
   148     UserPathPrefix:= copy(UserPathPrefix, 1, length(UserPathPrefix) - 1);
   149     UserPathPrefix:= copy(UserPathPrefix, 1, length(UserPathPrefix) - 1);
   149  
   150  
   150     LoadLocale(Strpas(filename));
   151     LoadLocale(Strpas(filename));
   151  
   152  
   152     uPhysFSLayer.freeModule;
   153     uPhysFSLayer.freeModule;
   153     uVariables.freeModule;
       
   154     uUtils.freeModule;
       
   155 end;
   154 end;
   156 {$ENDIF}
   155 {$ENDIF}
   157 
   156 
   158 end.
   157 end.