- Pass also userPath to LoadLocaleWrapper
authorantonc27 <antonc27@mail.ru>
Tue, 03 May 2016 01:13:41 +0200
changeset 11790ac93cfc17365
parent 11789 e2de320aaf69
child 11791 3127b0fece81
- Pass also userPath to LoadLocaleWrapper

TODO: Find a way to simplify all of this...
hedgewars/uLocale.pas
project_files/HedgewarsMobile/Classes/PascalImports.h
project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m
     1.1 --- a/hedgewars/uLocale.pas	Tue May 03 01:09:36 2016 +0200
     1.2 +++ b/hedgewars/uLocale.pas	Tue May 03 01:13:41 2016 +0200
     1.3 @@ -30,7 +30,7 @@
     1.4  function  GetEventString(e: TEventId): ansistring;
     1.5  
     1.6  {$IFDEF HWLIBRARY}
     1.7 -procedure LoadLocaleWrapper(path: pchar; filename: pchar); cdecl; export;
     1.8 +procedure LoadLocaleWrapper(path: pchar; userpath: pchar; filename: pchar); cdecl; export;
     1.9  {$ENDIF}
    1.10  
    1.11  implementation
    1.12 @@ -134,13 +134,14 @@
    1.13  end;
    1.14  
    1.15  {$IFDEF HWLIBRARY}
    1.16 -procedure LoadLocaleWrapper(path: pchar; filename: pchar); cdecl; export;
    1.17 +procedure LoadLocaleWrapper(path: pchar; userpath: pchar; filename: pchar); cdecl; export;
    1.18  begin
    1.19      PathPrefix := Strpas(path);
    1.20 +    UserPathPrefix := Strpas(userpath);
    1.21   
    1.22 -    uUtils.initModule(false);
    1.23 -    uVariables.initModule;
    1.24 -
    1.25 +    //normally this var set in preInit of engine
    1.26 +    allOK := true;
    1.27 +    
    1.28      PathPrefix:= PathPrefix + #0;
    1.29      UserPathPrefix:= UserPathPrefix + #0;
    1.30      uPhysFSLayer.initModule(@PathPrefix[1], @UserPathPrefix[1]);
    1.31 @@ -150,8 +151,6 @@
    1.32      LoadLocale(Strpas(filename));
    1.33   
    1.34      uPhysFSLayer.freeModule;
    1.35 -    uVariables.freeModule;
    1.36 -    uUtils.freeModule;
    1.37  end;
    1.38  {$ENDIF}
    1.39  
     2.1 --- a/project_files/HedgewarsMobile/Classes/PascalImports.h	Tue May 03 01:09:36 2016 +0200
     2.2 +++ b/project_files/HedgewarsMobile/Classes/PascalImports.h	Tue May 03 01:13:41 2016 +0200
     2.3 @@ -29,7 +29,7 @@
     2.4       */
     2.5  
     2.6      void RunEngine(const int argc, const char *argv[]);
     2.7 -    void LoadLocaleWrapper(const char *filepath, const char *filename);
     2.8 +    void LoadLocaleWrapper(const char *filepath, const char *userpath, const char *filename);
     2.9  
    2.10      void HW_versionInfo(int *protoNum, char **versionStr);
    2.11      void *HW_getSDLWindow(void);
     3.1 --- a/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m	Tue May 03 01:09:36 2016 +0200
     3.2 +++ b/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m	Tue May 03 01:13:41 2016 +0200
     3.3 @@ -39,7 +39,7 @@
     3.4      self.trPath = [NSString stringWithFormat:@"%@", LOCALE_DIRECTORY()];
     3.5      self.trFileName = [NSString stringWithFormat:@"%@.txt", [HWUtils languageID]];
     3.6      // fill the data structure that we are going to read
     3.7 -    LoadLocaleWrapper([self.trPath UTF8String], [self.trFileName UTF8String]);
     3.8 +    LoadLocaleWrapper([self.trPath UTF8String], [DOCUMENTS_FOLDER() UTF8String], [self.trFileName UTF8String]);
     3.9  
    3.10      quantity = (char *)malloc(sizeof(char)*(HW_getNumberOfWeapons()+1));
    3.11      probability = (char *)malloc(sizeof(char)*(HW_getNumberOfWeapons()+1));