Browse Source

introduce startup options

* startup options with -help and -version
* many startup options for graphics
Eduardo Bart 9 years ago
parent
commit
159eb98df2
57 changed files with 77 additions and 2 deletions
  1. 0
    0
      modules/game_battle/battle.lua
  2. 0
    0
      modules/game_battle/battle.otmod
  3. 0
    0
      modules/game_battle/battle.otui
  4. 0
    0
      modules/game_battle/battle.png
  5. 0
    0
      modules/game_battle/battleButton.otui
  6. 0
    0
      modules/game_battle/battle_monsters.png
  7. 0
    0
      modules/game_battle/battle_npcs.png
  8. 0
    0
      modules/game_battle/battle_party.png
  9. 0
    0
      modules/game_battle/battle_players.png
  10. 0
    0
      modules/game_battle/battle_skulls.png
  11. 0
    0
      modules/game_combatcontrols/combatcontrols.lua
  12. 0
    0
      modules/game_combatcontrols/combatcontrols.otmod
  13. 0
    0
      modules/game_combatcontrols/combatcontrols.otui
  14. 0
    0
      modules/game_combatcontrols/combatcontrols.png
  15. 0
    0
      modules/game_combatcontrols/icons/chasemode.png
  16. 0
    0
      modules/game_combatcontrols/icons/fightbalanced.png
  17. 0
    0
      modules/game_combatcontrols/icons/fightdefensive.png
  18. 0
    0
      modules/game_combatcontrols/icons/fightoffensive.png
  19. 0
    0
      modules/game_combatcontrols/icons/safefight.png
  20. 0
    0
      modules/game_containers/container.otui
  21. 0
    0
      modules/game_containers/containers.lua
  22. 0
    0
      modules/game_containers/containers.otmod
  23. 0
    0
      modules/game_healthbar/healthbar.lua
  24. 0
    0
      modules/game_healthbar/healthbar.otmod
  25. 0
    0
      modules/game_healthbar/healthbar.otui
  26. 0
    0
      modules/game_healthbar/healthbar.png
  27. 0
    0
      modules/game_hotkeys/hotkeys_manager.lua
  28. 0
    0
      modules/game_hotkeys/hotkeys_manager.otmod
  29. 0
    0
      modules/game_hotkeys/hotkeys_manager.otui
  30. 0
    0
      modules/game_hotkeys/icon.png
  31. 0
    0
      modules/game_interface/gameinterface.lua
  32. 0
    0
      modules/game_interface/gameinterface.otmod
  33. 0
    0
      modules/game_interface/gameinterface.otui
  34. 0
    0
      modules/game_interface/uimap.lua
  35. 0
    0
      modules/game_inventory/inventory.lua
  36. 0
    0
      modules/game_inventory/inventory.otmod
  37. 0
    0
      modules/game_inventory/inventory.otui
  38. 0
    0
      modules/game_inventory/inventory.png
  39. 0
    0
      modules/game_outfit/outfit.lua
  40. 0
    0
      modules/game_outfit/outfit.otmod
  41. 0
    0
      modules/game_outfit/outfit.otui
  42. 0
    0
      modules/game_skills/skills.lua
  43. 0
    0
      modules/game_skills/skills.otmod
  44. 0
    0
      modules/game_skills/skills.otui
  45. 0
    0
      modules/game_viplist/addvip.otui
  46. 0
    0
      modules/game_viplist/viplist.lua
  47. 0
    0
      modules/game_viplist/viplist.otmod
  48. 0
    0
      modules/game_viplist/viplist.otui
  49. 0
    0
      modules/game_viplist/viplist.png
  50. 8
    0
      src/framework/application.cpp
  51. 1
    0
      src/framework/application.h
  52. 4
    0
      src/framework/graphics/coordsbuffer.cpp
  53. 17
    0
      src/framework/graphics/graphics.cpp
  54. 3
    0
      src/framework/graphics/graphics.h
  55. 4
    1
      src/framework/graphics/texture.cpp
  56. 1
    1
      src/framework/ui/uiwidgetimage.cpp
  57. 39
    0
      src/otclient/otclient.cpp

modules/old/game_battle/battle.lua → modules/game_battle/battle.lua View File


modules/old/game_battle/battle.otmod → modules/game_battle/battle.otmod View File


modules/old/game_battle/battle.otui → modules/game_battle/battle.otui View File


modules/old/game_battle/battle.png → modules/game_battle/battle.png View File


modules/old/game_battle/battleButton.otui → modules/game_battle/battleButton.otui View File


modules/old/game_battle/battle_monsters.png → modules/game_battle/battle_monsters.png View File


modules/old/game_battle/battle_npcs.png → modules/game_battle/battle_npcs.png View File


modules/old/game_battle/battle_party.png → modules/game_battle/battle_party.png View File


modules/old/game_battle/battle_players.png → modules/game_battle/battle_players.png View File


modules/old/game_battle/battle_skulls.png → modules/game_battle/battle_skulls.png View File


modules/old/game_combatcontrols/combatcontrols.lua → modules/game_combatcontrols/combatcontrols.lua View File


modules/old/game_combatcontrols/combatcontrols.otmod → modules/game_combatcontrols/combatcontrols.otmod View File


modules/old/game_combatcontrols/combatcontrols.otui → modules/game_combatcontrols/combatcontrols.otui View File


modules/old/game_combatcontrols/combatcontrols.png → modules/game_combatcontrols/combatcontrols.png View File


modules/old/game_combatcontrols/icons/chasemode.png → modules/game_combatcontrols/icons/chasemode.png View File


modules/old/game_combatcontrols/icons/fightbalanced.png → modules/game_combatcontrols/icons/fightbalanced.png View File


modules/old/game_combatcontrols/icons/fightdefensive.png → modules/game_combatcontrols/icons/fightdefensive.png View File


modules/old/game_combatcontrols/icons/fightoffensive.png → modules/game_combatcontrols/icons/fightoffensive.png View File


modules/old/game_combatcontrols/icons/safefight.png → modules/game_combatcontrols/icons/safefight.png View File


modules/old/game_containers/container.otui → modules/game_containers/container.otui View File


modules/old/game_containers/containers.lua → modules/game_containers/containers.lua View File


modules/old/game_containers/containers.otmod → modules/game_containers/containers.otmod View File


modules/old/game_healthbar/healthbar.lua → modules/game_healthbar/healthbar.lua View File


modules/old/game_healthbar/healthbar.otmod → modules/game_healthbar/healthbar.otmod View File


modules/old/game_healthbar/healthbar.otui → modules/game_healthbar/healthbar.otui View File


modules/old/game_healthbar/healthbar.png → modules/game_healthbar/healthbar.png View File


modules/old/game_hotkeys/hotkeys_manager.lua → modules/game_hotkeys/hotkeys_manager.lua View File


modules/old/game_hotkeys/hotkeys_manager.otmod → modules/game_hotkeys/hotkeys_manager.otmod View File


modules/old/game_hotkeys/hotkeys_manager.otui → modules/game_hotkeys/hotkeys_manager.otui View File


modules/old/game_hotkeys/icon.png → modules/game_hotkeys/icon.png View File


modules/old/game_interface/gameinterface.lua → modules/game_interface/gameinterface.lua View File


modules/old/game_interface/gameinterface.otmod → modules/game_interface/gameinterface.otmod View File


modules/old/game_interface/gameinterface.otui → modules/game_interface/gameinterface.otui View File


modules/old/game_interface/uimap.lua → modules/game_interface/uimap.lua View File


modules/old/game_inventory/inventory.lua → modules/game_inventory/inventory.lua View File


modules/old/game_inventory/inventory.otmod → modules/game_inventory/inventory.otmod View File


modules/old/game_inventory/inventory.otui → modules/game_inventory/inventory.otui View File


modules/old/game_inventory/inventory.png → modules/game_inventory/inventory.png View File


modules/old/game_outfit/outfit.lua → modules/game_outfit/outfit.lua View File


modules/old/game_outfit/outfit.otmod → modules/game_outfit/outfit.otmod View File


modules/old/game_outfit/outfit.otui → modules/game_outfit/outfit.otui View File


modules/old/game_skills/skills.lua → modules/game_skills/skills.lua View File


modules/old/game_skills/skills.otmod → modules/game_skills/skills.otmod View File


modules/old/game_skills/skills.otui → modules/game_skills/skills.otui View File


modules/old/game_viplist/addvip.otui → modules/game_viplist/addvip.otui View File


modules/old/game_viplist/viplist.lua → modules/game_viplist/viplist.lua View File


modules/old/game_viplist/viplist.otmod → modules/game_viplist/viplist.otmod View File


modules/old/game_viplist/viplist.otui → modules/game_viplist/viplist.otui View File


modules/old/game_viplist/viplist.png → modules/game_viplist/viplist.png View File


+ 8
- 0
src/framework/application.cpp View File

@@ -115,10 +115,15 @@ void Application::init(const std::vector<std::string>& args, int appFlags)
115 115
 
116 116
     if(m_appFlags & Fw::AppEnableModules)
117 117
         g_modules.discoverModulesPath();
118
+
119
+    m_initialized = true;
118 120
 }
119 121
 
120 122
 void Application::terminate()
121 123
 {
124
+    if(!m_initialized)
125
+        return;
126
+
122 127
     g_lua.callGlobalField("g_app", "onTerminate");
123 128
 
124 129
     // hide the window because there is no render anymore
@@ -162,6 +167,9 @@ void Application::terminate()
162 167
 
163 168
 void Application::run()
164 169
 {
170
+    if(!m_initialized)
171
+        return;
172
+
165 173
     ticks_t lastPollTicks = g_clock.updateTicks();
166 174
     m_stopping = false;
167 175
     m_running = true;

+ 1
- 0
src/framework/application.h View File

@@ -65,6 +65,7 @@ protected:
65 65
     std::string m_appBuildDate;
66 66
     int m_appFlags;
67 67
     int m_pollCycleDelay;
68
+    Boolean<false> m_initialized;
68 69
     Boolean<false> m_running;
69 70
     Boolean<false> m_stopping;
70 71
 };

+ 4
- 0
src/framework/graphics/coordsbuffer.cpp View File

@@ -21,6 +21,7 @@
21 21
  */
22 22
 
23 23
 #include "coordsbuffer.h"
24
+#include "graphics.h"
24 25
 
25 26
 CoordsBuffer::CoordsBuffer()
26 27
 {
@@ -86,6 +87,9 @@ void CoordsBuffer::addRepeatedRects(const Rect& dest, const Rect& src)
86 87
 
87 88
 void CoordsBuffer::enableHardwareCaching(HardwareBuffer::UsagePattern usagePattern)
88 89
 {
90
+    if(!g_graphics.canUseHardwareBuffers())
91
+        return;
92
+
89 93
 #ifndef OPENGL_ES2
90 94
     if(!GL_ARB_vertex_buffer_object)
91 95
         return;

+ 17
- 0
src/framework/graphics/graphics.cpp View File

@@ -62,6 +62,23 @@ void Graphics::terminate()
62 62
     m_emptyTexture.reset();
63 63
 }
64 64
 
65
+bool Graphics::parseOption(const std::string& option)
66
+{
67
+    if(option == "-no-fbos")
68
+        m_useFBO = false;
69
+    else if(option == "-no-mipmapping")
70
+        m_generateMipmaps = false;
71
+    else if(option == "-no-smoothing")
72
+        m_useBilinearFiltering = false;
73
+    else if(option == "-realtime-mipmapping")
74
+        m_generateRealtimeMipmaps = true;
75
+    else if(option == "-no-hardware-buffering")
76
+        m_useHardwareBuffers = false;
77
+    else
78
+        return false;
79
+    return true;
80
+}
81
+
65 82
 void Graphics::resize(const Size& size)
66 83
 {
67 84
     setViewportSize(size);

+ 3
- 0
src/framework/graphics/graphics.h View File

@@ -31,9 +31,11 @@ class Graphics
31 31
 public:
32 32
     void init();
33 33
     void terminate();
34
+    bool parseOption(const std::string& option);
34 35
 
35 36
     bool canUseFBO() { return m_useFBO; }
36 37
     bool canUseBilinearFiltering() { return m_useBilinearFiltering; }
38
+    bool canUseHardwareBuffers() { return m_useHardwareBuffers; }
37 39
     bool canGenerateMipmaps() { return m_generateMipmaps; }
38 40
     bool canGenerateHardwareMipmaps() { return m_generateHardwareMipmaps; }
39 41
     bool canGenerateRealtimeMipmaps() { return m_generateRealtimeMipmaps; }
@@ -53,6 +55,7 @@ private:
53 55
     TexturePtr m_emptyTexture;
54 56
 
55 57
     Boolean<true> m_useFBO;
58
+    Boolean<true> m_useHardwareBuffers;
56 59
     Boolean<true> m_useBilinearFiltering;
57 60
     Boolean<true> m_generateMipmaps;
58 61
     Boolean<true> m_generateHardwareMipmaps;

+ 4
- 1
src/framework/graphics/texture.cpp View File

@@ -103,7 +103,9 @@ void Texture::generateMipmaps()
103 103
         generateHardwareMipmaps();
104 104
     else {
105 105
         // fallback to software mipmaps generation, this can be slow
106
-        generateSoftwareMipmaps(getPixels());
106
+        //FIXME: disable because mipmaps size needs to be in base of 2,
107
+        //       and the current algorithmn does not support that
108
+        //generateSoftwareMipmaps(getPixels());
107 109
     }
108 110
 }
109 111
 
@@ -169,6 +171,7 @@ void Texture::generateSoftwareMipmaps(std::vector<uint8> inPixels)
169 171
     Size outSize = inSize / 2;
170 172
     std::vector<uint8> outPixels(outSize.area()*4);
171 173
 
174
+    dump << "yeah";
172 175
     int mipmap = 1;
173 176
     while(true) {
174 177
         // this is a simple bilinear filtering algorithm, it combines every 4 pixels in one pixel

+ 1
- 1
src/framework/ui/uiwidgetimage.cpp View File

@@ -168,7 +168,7 @@ void UIWidget::drawImage(const Rect& screenCoords)
168 168
     m_imageTexture->setSmooth(m_imageSmooth);
169 169
 
170 170
     // this will increase fps when rendering larger images, like the background, and improve image quality
171
-    if(m_imageSmooth && g_graphics.canGenerateMipmaps() && !m_imageTexture->hasMipmaps())
171
+    if(m_imageSmooth && !m_imageTexture->hasMipmaps() && g_graphics.canGenerateMipmaps())
172 172
         m_imageTexture->generateMipmaps();
173 173
 
174 174
     g_painter.setColor(m_imageColor);

+ 39
- 0
src/otclient/otclient.cpp View File

@@ -23,6 +23,7 @@
23 23
 #include "otclient.h"
24 24
 #include <framework/core/modulemanager.h>
25 25
 #include <framework/core/resourcemanager.h>
26
+#include <framework/graphics/graphics.h>
26 27
 #include "core/game.h"
27 28
 #include "core/map.h"
28 29
 
@@ -33,11 +34,49 @@ OTClient::OTClient() : Application(Otc::AppCompactName)
33 34
 
34 35
 void OTClient::init(const std::vector<std::string>& args)
35 36
 {
37
+    std::string startupOptions;
38
+    for(uint i=1;i<args.size();++i) {
39
+        const std::string& arg = args[i];
40
+        startupOptions += " ";
41
+        startupOptions += arg;
42
+
43
+        if(g_graphics.parseOption(arg))
44
+            continue;
45
+
46
+        if(arg == "-version" || arg == "--version" || arg == "-v") {
47
+            Fw::print(Otc::AppName, " ", Otc::AppVersion, "\n"
48
+                      "Buitt on: ", BUILD_DATE, "\n",
49
+                      "Revision: ", BUILD_REVISION, "\n",
50
+                      "Compiled by: ", BUILD_COMPILER, "\n",
51
+                      "Build type: ", BUILD_TYPE, "\n");
52
+            return;
53
+        } else if(arg == "-help" || arg == "--help" || arg == "-h") {
54
+            Fw::print("Usage: ", args[0], " [options]\n"
55
+                      "Options:\n"
56
+                      "  -help                   Display this information and exit\n"
57
+                      "  -version                Display version and exit\n"
58
+                      "\n"
59
+                      "  -no-fbos                Disable usage of opengl framebuffer objects\n"
60
+                      "  -no-mipmapping          Disable texture mipmaping\n"
61
+                      "  -no-smoothing           Disable texture smoothing (bilinear filter)\n"
62
+                      "  -no-hardware-buffering  Disable buffering vertex arrays in hardware\n"
63
+                      "  -realtime-mipmapping    Improve framebuffer smoothing quality by\n"
64
+                      "                          generating mipmaps in realtime when hardware\n"
65
+                      "                          mipmap generation implementation is available\n");
66
+            return;
67
+        } else {
68
+            Fw::println("Unrecognized option '", arg, "', please see -help for available options list");
69
+            return;
70
+        }
71
+    }
72
+
36 73
     logInfo(Fw::formatString("%s %s (rev %s) built on %s",
37 74
                              Otc::AppName,
38 75
                              Otc::AppVersion,
39 76
                              BUILD_REVISION,
40 77
                              BUILD_DATE));
78
+    if(startupOptions.length() > 0)
79
+        logInfo("Startup options:", startupOptions);
41 80
 
42 81
     g_logger.setLogFile(Fw::formatString("%s.txt", Otc::AppCompactName));
43 82
     Application::init(args, Fw::AppEnableAll);

Loading…
Cancel
Save