A simple addon that allows you to set the FPS divisor of NosTale. (Default value is 18, 0 is uncapped.)

fpscap.lua 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. --[[
  2. * NosHook - Copyright (c) 2016 atom0s [atom0s@live.com]
  3. *
  4. * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
  5. * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to
  6. * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
  7. *
  8. * By using NosHook, you agree to the above license and its terms.
  9. *
  10. * Attribution - You must give appropriate credit, provide a link to the license and indicate if changes were
  11. * made. You must do so in any reasonable manner, but not in any way that suggests the licensor
  12. * endorses you or your use.
  13. *
  14. * Non-Commercial - You may not use the material (NosHook) for commercial purposes.
  15. *
  16. * No-Derivatives - If you remix, transform, or build upon the material (NosHook), you may not distribute the
  17. * modified material. You are, however, allowed to submit the modified works back to the original
  18. * NosHook project in attempt to have it added to the original project.
  19. *
  20. * You may not apply legal terms or technological measures that legally restrict others
  21. * from doing anything the license permits.
  22. *
  23. * No warranties are given.
  24. ]]--
  25. _addon.author = 'atom0s';
  26. _addon.name = 'FPSCap';
  27. _addon.version = '1.0.1';
  28. require 'common';
  29. ----------------------------------------------------------------------------------------------------
  30. -- Variables
  31. ----------------------------------------------------------------------------------------------------
  32. local fps_pointer = 0;
  33. ----------------------------------------------------------------------------------------------------
  34. -- func: load
  35. -- desc: Event called when the addon is being loaded.
  36. ----------------------------------------------------------------------------------------------------
  37. hook.register_event('load', function()
  38. -- Locate the fps divisor pointer..
  39. local ptr = mem.FindPattern('nostaleclientx.exe', '6AFFA1????????8B002BC350', 0x03, 0x00);
  40. if (ptr == 0) then
  41. error('Failed to locate fps divisor pointer!');
  42. return false;
  43. end
  44. -- Read the pointer..
  45. ptr = mem.ReadULong(ptr);
  46. fps_pointer = mem.ReadULong(ptr);
  47. return true;
  48. end);
  49. ----------------------------------------------------------------------------------------------------
  50. -- func: command
  51. -- desc: Event called when a console command has been entered.
  52. ----------------------------------------------------------------------------------------------------
  53. hook.register_event('command', function(cmd)
  54. -- Parse the function for args..
  55. local args = cmd:GetArgs();
  56. -- Handle the fpscap command..
  57. if (#args == 2 and args[1] == '/fpscap') then
  58. local divisor = tonumber(args[2]);
  59. mem.WriteUChar(fps_pointer, divisor);
  60. print(string.format('[FPSCap] Set FPS divisor to: %d', divisor));
  61. return true;
  62. end
  63. return false;
  64. end);