Author |
Message
Pages: 1
|
Molotov Member (send private message) Posts: 49 Topics: 21 Location: Behind Keyboard | [819] Access violation when trying to loadsettings - posted: 2011-11-24 07:36:17 So what im trying to do is a way to load settings from a txt doc with the syntax Code:
Code:
It compiles ok but when i try to run it i get Access Violation error at address: 4212015 all help i can get is greatly appriciated. "Lerning new things is what life is all about, if you are always doing the same old things day in and day out you might aswell just kill yourself." - ME d^_^b |
Admin Site Admin (send private message) Posts: 933 Topics: 55 Location: OverHertz Studio | [820] - posted: 2011-11-24 10:32:02 first problem i see is that because it is an inline function the "uses" may cause you problems if you call it in a global scope.. and also that uses should be at only the top of a function.... remember that "inline functions" are macros, anything written inside is output where they are called, since such things as LoadSettings() are a 1 time only call i would suggest to make it an actual function by removing "inline", any reason why you are restoring eax aswell? also btw you can do: Code:
second problem is Code:
loadfs only loads a file on assembly time, meaning that your settings file would be static, you would need to use fileread to read it dynamically. 3rd problem is alot of usage of EAX but it would point no where... you are trying to write into strange areas of memory 4th problem: Code:
Last but not least, why don't you just use the INI include file and make your settings file an ini? it is almost same format, just needs a section Code:
Download Ziron Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message. |
Admin Site Admin (send private message) Posts: 933 Topics: 55 Location: OverHertz Studio | [821] - posted: 2011-11-24 10:44:13 here is a sample of using ini file settings.ini: Code:
code: Code:
a quick explanation of Ini_ReadString. Parameters: 1 - Location/Filename of your settings file 2 - A pointer to a buffer to hold the string that is read. 3 - The section inside the INI file to search. 4 - The identifier of the setting to get from the section. 5 - The default string to return if ident(4) can not be found. 6 - The maximum buffer size (the size of memory allocated for reading your setting) Hope this helps, let me know. Download Ziron Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message. |
Admin Site Admin (send private message) Posts: 933 Topics: 55 Location: OverHertz Studio | [822] - posted: 2011-11-24 11:33:16 I've just put together a new function for you that does not rely on ini files, plus a test app, I've not test it much but you should be able to customize it to your needs. Code:
i have added some comments here and there to help you understand what exactly is going on, if you need explanation of some of the code, just let me know. Download Ziron Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message. |
Currently Active Users: There are currently 5 user(s) online. 0 member(s) and 5 guest(s) Most users ever online was 1046, January 28, 2022, 2:08 pm. Statistics: Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51 Welcome to our newest member, yecate |