01/02/2020 #1

This commit is contained in:
TheGreenTie 2020-02-17 14:19:53 -06:00
parent 3061350f39
commit 2d87607edc
27 changed files with 4819 additions and 1334 deletions

View File

@ -222,8 +222,8 @@
<option_frequency>0</option_frequency>
<option_frontimage>nil</option_frontimage>
<option_fullscreen>False</option_fullscreen>
<option_gameguid>{D242171F-68AC-415F-95CA-A6C1E6F1F95F}</option_gameguid>
<option_gameid>350581466</option_gameid>
<option_gameguid>{E0833200-DDCB-48EF-B22C-B65B9A7F033A}</option_gameguid>
<option_gameid>835589168</option_gameid>
<option_hasloadimage>false</option_hasloadimage>
<option_helpkey>true</option_helpkey>
<option_html5_CreationEventOrder>true</option_html5_CreationEventOrder>

View File

@ -39850,6 +39850,7 @@
</datafiles>
<NewExtensions>
<extension index="0">extensions\CSV Manager</extension>
<extension index="1">extensions\nsfs</extension>
</NewExtensions>
<sounds name="sound"/>
<sprites name="sprites">
@ -39868,6 +39869,8 @@
<script>scripts\array_draw_debug.gml</script>
<script>scripts\scr_window_resize.gml</script>
<script>scripts\scr_typeget.gml</script>
<script>scripts\get_color3.gml</script>
<script>scripts\scr_zeros.gml</script>
</scripts>
<objects name="objects">
<object>objects\obj_global</object>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,503 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<extension>
<name>nsfs</name>
<version>1.0.2</version>
<packageID>cc.yal.nsfs</packageID>
<ProductID></ProductID>
<date>18/02/17</date>
<license>Proprietary</license>
<description></description>
<helpfile></helpfile>
<installdir></installdir>
<classname></classname>
<androidclassname></androidclassname>
<sourcedir></sourcedir>
<androidsourcedir></androidsourcedir>
<macsourcedir></macsourcedir>
<maclinkerflags></maclinkerflags>
<maccompilerflags></maccompilerflags>
<androidinject></androidinject>
<androidmanifestinject></androidmanifestinject>
<iosplistinject></iosplistinject>
<androidactivityinject></androidactivityinject>
<gradleinject></gradleinject>
<iosSystemFrameworks/>
<iosThirdPartyFrameworks/>
<ConfigOptions>
<Config name="Default">
<CopyToMask>113497714299118</CopyToMask>
</Config>
</ConfigOptions>
<androidPermissions/>
<IncludedResources>
<Resource>Sprites\spr_nsfs_demo_white32</Resource>
<Resource>Scripts\demo-scripts\demo_button</Resource>
<Resource>Scripts\demo-scripts\demo_trace</Resource>
<Resource>Scripts\demo-scripts\demo_prompt</Resource>
<Resource>Scripts\demo-scripts\demo_param</Resource>
<Resource>Scripts\demo-scripts\demo_sfmt</Resource>
<Resource>Scripts\demo-scripts\demo_status</Resource>
<Resource>Fonts\fnt_nsfs_demo</Resource>
<Resource>Objects\obj_nsfs_demo</Resource>
<Resource>Rooms\rm_nsfs_demo</Resource>
<Resource>Included Files\nsfs-doc.html</Resource>
</IncludedResources>
<files>
<file>
<filename>nsfs.dll</filename>
<origname>extensions\nsfs.dll</origname>
<init></init>
<final></final>
<kind>1</kind>
<uncompress>0</uncompress>
<ConfigOptions>
<Config name="Default">
<CopyToMask>113497714299118</CopyToMask>
</Config>
</ConfigOptions>
<ProxyFiles/>
<functions>
<function>
<name>nsfs_get_status</name>
<externalName>nsfs_get_status</externalName>
<kind>11</kind>
<help></help>
<returnType>2</returnType>
<argCount>0</argCount>
<args/>
</function>
<function>
<name>nsfs_get_directory</name>
<externalName>nsfs_get_directory</externalName>
<kind>11</kind>
<help></help>
<returnType>1</returnType>
<argCount>0</argCount>
<args/>
</function>
<function>
<name>nsfs_set_directory</name>
<externalName>nsfs_set_directory</externalName>
<kind>11</kind>
<help></help>
<returnType>2</returnType>
<argCount>1</argCount>
<args>
<arg>1</arg>
</args>
</function>
<function>
<name>nsfs_init_raw</name>
<externalName>nsfs_init_raw</externalName>
<kind>11</kind>
<help></help>
<returnType>2</returnType>
<argCount>0</argCount>
<args/>
</function>
<function>
<name>file_get_attributes_ns</name>
<externalName>file_get_attributes_ns</externalName>
<kind>11</kind>
<help>file_get_attributes_ns(path) : returned values as per https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117(v=vs.85).aspx</help>
<returnType>2</returnType>
<argCount>1</argCount>
<args>
<arg>1</arg>
</args>
</function>
<function>
<name>file_set_attributes_ns</name>
<externalName>file_set_attributes_ns</externalName>
<kind>11</kind>
<help>file_set_attributes_ns(path, flags) : flags as per https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117(v=vs.85).aspx</help>
<returnType>2</returnType>
<argCount>2</argCount>
<args>
<arg>1</arg>
<arg>2</arg>
</args>
</function>
<function>
<name>file_get_size_ns</name>
<externalName>file_get_size_ns</externalName>
<kind>11</kind>
<help>file_get_size_ns(path) : Returns size of the given file, in bytes.</help>
<returnType>2</returnType>
<argCount>1</argCount>
<args>
<arg>1</arg>
</args>
</function>
<function>
<name>file_exists_ns</name>
<externalName>file_exists_ns</externalName>
<kind>11</kind>
<help>file_exists_ns(path)</help>
<returnType>2</returnType>
<argCount>1</argCount>
<args>
<arg>1</arg>
</args>
</function>
<function>
<name>directory_exists_ns</name>
<externalName>directory_exists_ns</externalName>
<kind>11</kind>
<help>directory_exists_ns(path)</help>
<returnType>2</returnType>
<argCount>1</argCount>
<args>
<arg>1</arg>
</args>
</function>
<function>
<name>file_delete_ns</name>
<externalName>file_delete_ns</externalName>
<kind>11</kind>
<help>file_delete_ns(path)</help>
<returnType>2</returnType>
<argCount>1</argCount>
<args>
<arg>1</arg>
</args>
</function>
<function>
<name>directory_delete_ns</name>
<externalName>directory_delete_ns</externalName>
<kind>11</kind>
<help>directory_delete_ns(path)</help>
<returnType>2</returnType>
<argCount>1</argCount>
<args>
<arg>1</arg>
</args>
</function>
<function>
<name>file_copy_ns</name>
<externalName>file_copy_ns</externalName>
<kind>11</kind>
<help>file_copy_ns(from, to)</help>
<returnType>2</returnType>
<argCount>2</argCount>
<args>
<arg>1</arg>
<arg>1</arg>
</args>
</function>
<function>
<name>directory_copy_ns</name>
<externalName>directory_copy_ns</externalName>
<kind>11</kind>
<help>directory_copy_ns(from, to)</help>
<returnType>2</returnType>
<argCount>2</argCount>
<args>
<arg>1</arg>
<arg>1</arg>
</args>
</function>
<function>
<name>file_rename_ns</name>
<externalName>file_rename_ns</externalName>
<kind>11</kind>
<help>file_rename_ns(from, to)</help>
<returnType>2</returnType>
<argCount>2</argCount>
<args>
<arg>1</arg>
<arg>1</arg>
</args>
</function>
<function>
<name>directory_rename_ns</name>
<externalName>directory_rename_ns</externalName>
<kind>11</kind>
<help>directory_rename_ns(from, to)</help>
<returnType>2</returnType>
<argCount>2</argCount>
<args>
<arg>1</arg>
<arg>1</arg>
</args>
</function>
<function>
<name>file_move_ns</name>
<externalName>file_move_ns</externalName>
<kind>11</kind>
<help>file_move_ns(from, to)</help>
<returnType>2</returnType>
<argCount>2</argCount>
<args>
<arg>1</arg>
<arg>1</arg>
</args>
</function>
<function>
<name>directory_move_ns</name>
<externalName>directory_move_ns</externalName>
<kind>11</kind>
<help>directory_move_ns(from, to)</help>
<returnType>2</returnType>
<argCount>2</argCount>
<args>
<arg>1</arg>
<arg>1</arg>
</args>
</function>
<function>
<name>file_find_first_ns</name>
<externalName>file_find_first_ns</externalName>
<kind>11</kind>
<help>file_find_first_ns(mask)</help>
<returnType>1</returnType>
<argCount>1</argCount>
<args>
<arg>1</arg>
</args>
</function>
<function>
<name>file_find_next_ns</name>
<externalName>file_find_next_ns</externalName>
<kind>11</kind>
<help>file_find_next_ns()</help>
<returnType>1</returnType>
<argCount>0</argCount>
<args/>
</function>
<function>
<name>file_find_close_ns</name>
<externalName>file_find_close_ns</externalName>
<kind>11</kind>
<help>file_find_close_ns()</help>
<returnType>2</returnType>
<argCount>0</argCount>
<args/>
</function>
<function>
<name>file_find_attributes_ns</name>
<externalName>file_find_attributes_ns</externalName>
<kind>11</kind>
<help>file_find_attributes_ns() : Returns the attributes of the current file in file_find</help>
<returnType>2</returnType>
<argCount>0</argCount>
<args/>
</function>
<function>
<name>file_find_size_ns</name>
<externalName>file_find_size_ns</externalName>
<kind>11</kind>
<help>file_find_size_ns() : Returns the size (in bytes) of the current file in file_find</help>
<returnType>2</returnType>
<argCount>0</argCount>
<args/>
</function>
<function>
<name>file_text_open_read_ns</name>
<externalName>file_text_open_read_ns</externalName>
<kind>11</kind>
<help>file_text_open_read_ns(path, codepage) : Codepage can be set to -1 for default (UTF-8)</help>
<returnType>2</returnType>
<argCount>2</argCount>
<args>
<arg>1</arg>
<arg>2</arg>
</args>
</function>
<function>
<name>file_text_open_write_ns</name>
<externalName>file_text_open_write_ns</externalName>
<kind>11</kind>
<help>file_text_open_write_ns(path, codepage) : Codepage can be set to -1 for default (UTF-8)</help>
<returnType>2</returnType>
<argCount>2</argCount>
<args>
<arg>1</arg>
<arg>2</arg>
</args>
</function>
<function>
<name>file_text_open_append_ns</name>
<externalName>file_text_open_append_ns</externalName>
<kind>11</kind>
<help>file_text_open_append_ns(path, codepage) : Codepage can be set to -1 for default (UTF-8)</help>
<returnType>2</returnType>
<argCount>2</argCount>
<args>
<arg>1</arg>
<arg>2</arg>
</args>
</function>
<function>
<name>file_text_close_ns</name>
<externalName>file_text_close_ns</externalName>
<kind>11</kind>
<help>file_text_close_ns(fileid)</help>
<returnType>2</returnType>
<argCount>1</argCount>
<args>
<arg>2</arg>
</args>
</function>
<function>
<name>file_text_eof_ns</name>
<externalName>file_text_eof_ns</externalName>
<kind>11</kind>
<help>file_text_eof_ns(fileid)</help>
<returnType>2</returnType>
<argCount>1</argCount>
<args>
<arg>2</arg>
</args>
</function>
<function>
<name>file_text_read_line_ns</name>
<externalName>file_text_read_line_ns</externalName>
<kind>11</kind>
<help>file_text_read_line_ns(fileid) : Reads the next line from a file, skips line separators after it.</help>
<returnType>1</returnType>
<argCount>1</argCount>
<args>
<arg>2</arg>
</args>
</function>
<function>
<name>file_text_write_line_ns</name>
<externalName>file_text_write_line_ns</externalName>
<kind>11</kind>
<help>file_text_write_line_ns(fileid, text) : Writes a line and line separators into a file.</help>
<returnType>2</returnType>
<argCount>2</argCount>
<args>
<arg>2</arg>
<arg>1</arg>
</args>
</function>
<function>
<name>buffer_load_ns_raw1</name>
<externalName>buffer_load_ns_raw1</externalName>
<kind>11</kind>
<help></help>
<returnType>2</returnType>
<argCount>1</argCount>
<args>
<arg>1</arg>
</args>
</function>
<function>
<name>buffer_load_ns_raw2</name>
<externalName>buffer_load_ns_raw2</externalName>
<kind>11</kind>
<help></help>
<returnType>2</returnType>
<argCount>2</argCount>
<args>
<arg>1</arg>
<arg>2</arg>
</args>
</function>
<function>
<name>buffer_save_ns_raw</name>
<externalName>buffer_save_ns_raw</externalName>
<kind>11</kind>
<help></help>
<returnType>2</returnType>
<argCount>3</argCount>
<args>
<arg>1</arg>
<arg>1</arg>
<arg>2</arg>
</args>
</function>
<function>
<name>string_codepage</name>
<externalName>string_codepage</externalName>
<kind>11</kind>
<help>string_codepage(str, codepage_from, codepage_to) : Converts a string between codepages. From/to can be set to -1 for UTF-8</help>
<returnType>1</returnType>
<argCount>3</argCount>
<args>
<arg>1</arg>
<arg>2</arg>
<arg>2</arg>
</args>
</function>
</functions>
<constants/>
</file>
<file>
<filename>nsfs.gml</filename>
<origname>extensions\gml.gml</origname>
<init>nsfs_init</init>
<final></final>
<kind>2</kind>
<uncompress>0</uncompress>
<ConfigOptions>
<Config name="Default">
<CopyToMask>113497714299118</CopyToMask>
</Config>
</ConfigOptions>
<ProxyFiles/>
<functions>
<function>
<name>nsfs_init</name>
<externalName>nsfs_init</externalName>
<kind>11</kind>
<help></help>
<returnType>2</returnType>
<argCount>0</argCount>
<args/>
</function>
<function>
<name>buffer_load_ns</name>
<externalName>buffer_load_ns</externalName>
<kind>11</kind>
<help>buffer_load_ns(path)</help>
<returnType>2</returnType>
<argCount>1</argCount>
<args>
<arg>2</arg>
</args>
</function>
<function>
<name>buffer_save_ns</name>
<externalName>buffer_save_ns</externalName>
<kind>11</kind>
<help>buffer_save_ns(buffer, path)</help>
<returnType>2</returnType>
<argCount>2</argCount>
<args>
<arg>2</arg>
<arg>2</arg>
</args>
</function>
<function>
<name>buffer_save_ext_ns</name>
<externalName>buffer_save_ext_ns</externalName>
<kind>11</kind>
<help>buffer_save_ext_ns(buffer, path, offset, size)</help>
<returnType>2</returnType>
<argCount>4</argCount>
<args>
<arg>2</arg>
<arg>2</arg>
<arg>2</arg>
<arg>2</arg>
</args>
</function>
</functions>
<constants>
<constant>
<name>nsfs_status</name>
<value>nsfs_get_status()</value>
<hidden>0</hidden>
</constant>
<constant>
<name>nsfs_is_available</name>
<value>global.g_nsfs_is_available</value>
<hidden>0</hidden>
</constant>
</constants>
</file>
</files>
</extension>

View File

@ -0,0 +1,117 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<font>
<name>Ubuntu Condensed SemiItalic</name>
<size>16</size>
<bold>0</bold>
<renderhq>-1</renderhq>
<italic>0</italic>
<charset>1</charset>
<aa>3</aa>
<includeTTF>0</includeTTF>
<TTFName></TTFName>
<texgroups>
<texgroup0>0</texgroup0>
</texgroups>
<ranges>
<range0>32,126</range0>
</ranges>
<glyphs>
<glyph character="32" x="133" y="83" w="4" h="24" shift="4" offset="0"/>
<glyph character="33" x="166" y="83" w="4" h="21" shift="6" offset="1"/>
<glyph character="34" x="185" y="83" w="7" h="11" shift="8" offset="2"/>
<glyph character="35" x="107" y="2" w="11" h="21" shift="12" offset="2"/>
<glyph character="36" x="181" y="56" w="7" h="23" shift="9" offset="2"/>
<glyph character="37" x="80" y="2" w="12" h="22" shift="14" offset="2"/>
<glyph character="38" x="212" y="2" w="10" h="21" shift="11" offset="1"/>
<glyph character="39" x="200" y="83" w="3" h="11" shift="5" offset="2"/>
<glyph character="40" x="2" y="83" w="6" h="25" shift="6" offset="2"/>
<glyph character="41" x="237" y="56" w="6" h="25" shift="6" offset="0"/>
<glyph character="42" x="139" y="83" w="7" h="13" shift="8" offset="2"/>
<glyph character="43" x="219" y="56" w="8" h="19" shift="9" offset="2"/>
<glyph character="44" x="127" y="83" w="4" h="24" shift="5" offset="1"/>
<glyph character="45" x="178" y="83" w="5" h="16" shift="5" offset="1"/>
<glyph character="46" x="148" y="83" w="4" h="22" shift="5" offset="1"/>
<glyph character="47" x="133" y="2" w="9" h="25" shift="6" offset="-1"/>
<glyph character="48" x="225" y="29" w="8" h="22" shift="9" offset="1"/>
<glyph character="49" x="114" y="83" w="5" h="21" shift="9" offset="3"/>
<glyph character="50" x="171" y="56" w="8" h="21" shift="9" offset="1"/>
<glyph character="51" x="215" y="29" w="8" h="22" shift="9" offset="1"/>
<glyph character="52" x="81" y="56" w="8" h="21" shift="9" offset="1"/>
<glyph character="53" x="41" y="56" w="8" h="21" shift="9" offset="1"/>
<glyph character="54" x="61" y="56" w="8" h="21" shift="9" offset="2"/>
<glyph character="55" x="31" y="56" w="8" h="21" shift="9" offset="2"/>
<glyph character="56" x="74" y="29" w="9" h="22" shift="9" offset="1"/>
<glyph character="57" x="121" y="56" w="8" h="21" shift="9" offset="2"/>
<glyph character="58" x="107" y="83" w="5" h="22" shift="5" offset="1"/>
<glyph character="59" x="90" y="83" w="5" h="24" shift="5" offset="1"/>
<glyph character="60" x="190" y="56" w="8" h="20" shift="9" offset="2"/>
<glyph character="61" x="55" y="83" w="8" h="18" shift="9" offset="1"/>
<glyph character="62" x="200" y="56" w="8" h="20" shift="9" offset="1"/>
<glyph character="63" x="210" y="56" w="7" h="22" shift="7" offset="2"/>
<glyph character="64" x="2" y="2" w="16" h="24" shift="18" offset="2"/>
<glyph character="65" x="26" y="29" w="10" h="21" shift="11" offset="1"/>
<glyph character="66" x="184" y="29" w="9" h="21" shift="11" offset="2"/>
<glyph character="67" x="85" y="29" w="9" h="22" shift="10" offset="2"/>
<glyph character="68" x="236" y="2" w="10" h="21" shift="12" offset="2"/>
<glyph character="69" x="111" y="56" w="8" h="21" shift="10" offset="2"/>
<glyph character="70" x="101" y="56" w="8" h="21" shift="9" offset="2"/>
<glyph character="71" x="96" y="29" w="9" h="22" shift="11" offset="2"/>
<glyph character="72" x="50" y="29" w="10" h="21" shift="12" offset="2"/>
<glyph character="73" x="154" y="83" w="4" h="21" shift="6" offset="2"/>
<glyph character="74" x="71" y="56" w="8" h="21" shift="9" offset="0"/>
<glyph character="75" x="2" y="29" w="10" h="21" shift="11" offset="2"/>
<glyph character="76" x="46" y="83" w="7" h="21" shift="9" offset="2"/>
<glyph character="77" x="50" y="2" w="13" h="21" shift="15" offset="2"/>
<glyph character="78" x="200" y="2" w="10" h="21" shift="12" offset="2"/>
<glyph character="79" x="94" y="2" w="11" h="22" shift="13" offset="2"/>
<glyph character="80" x="140" y="29" w="9" h="21" shift="10" offset="2"/>
<glyph character="81" x="37" y="2" w="11" h="25" shift="13" offset="2"/>
<glyph character="82" x="129" y="29" w="9" h="21" shift="11" offset="2"/>
<glyph character="83" x="195" y="29" w="8" h="22" shift="9" offset="1"/>
<glyph character="84" x="107" y="29" w="9" h="21" shift="9" offset="2"/>
<glyph character="85" x="38" y="29" w="10" h="21" shift="12" offset="2"/>
<glyph character="86" x="62" y="29" w="10" h="21" shift="11" offset="2"/>
<glyph character="87" x="20" y="2" w="15" h="21" shift="16" offset="2"/>
<glyph character="88" x="14" y="29" w="10" h="21" shift="10" offset="1"/>
<glyph character="89" x="188" y="2" w="10" h="21" shift="10" offset="2"/>
<glyph character="90" x="224" y="2" w="10" h="21" shift="9" offset="1"/>
<glyph character="91" x="229" y="56" w="6" h="25" shift="6" offset="2"/>
<glyph character="92" x="83" y="83" w="5" h="25" shift="6" offset="1"/>
<glyph character="93" x="244" y="29" w="7" h="25" shift="6" offset="-1"/>
<glyph character="94" x="97" y="83" w="8" h="14" shift="9" offset="2"/>
<glyph character="95" x="151" y="29" w="9" h="21" shift="8" offset="0"/>
<glyph character="96" x="194" y="83" w="4" h="9" shift="7" offset="2"/>
<glyph character="97" x="131" y="56" w="8" h="21" shift="9" offset="1"/>
<glyph character="98" x="173" y="29" w="9" h="21" shift="10" offset="2"/>
<glyph character="99" x="19" y="83" w="7" h="21" shift="8" offset="1"/>
<glyph character="100" x="162" y="29" w="9" h="21" shift="10" offset="1"/>
<glyph character="101" x="11" y="56" w="8" h="21" shift="9" offset="1"/>
<glyph character="102" x="28" y="83" w="7" h="21" shift="7" offset="2"/>
<glyph character="103" x="155" y="2" w="9" h="25" shift="10" offset="1"/>
<glyph character="104" x="151" y="56" w="8" h="21" shift="10" offset="2"/>
<glyph character="105" x="160" y="83" w="4" h="21" shift="5" offset="2"/>
<glyph character="106" x="2" y="56" w="7" h="25" shift="5" offset="-1"/>
<glyph character="107" x="141" y="56" w="8" h="21" shift="9" offset="2"/>
<glyph character="108" x="172" y="83" w="4" h="21" shift="5" offset="2"/>
<glyph character="109" x="65" y="2" w="13" h="21" shift="15" offset="2"/>
<glyph character="110" x="21" y="56" w="8" h="21" shift="10" offset="2"/>
<glyph character="111" x="118" y="29" w="9" h="21" shift="10" offset="1"/>
<glyph character="112" x="144" y="2" w="9" h="25" shift="10" offset="2"/>
<glyph character="113" x="177" y="2" w="9" h="25" shift="10" offset="1"/>
<glyph character="114" x="37" y="83" w="7" h="21" shift="7" offset="2"/>
<glyph character="115" x="10" y="83" w="7" h="21" shift="7" offset="1"/>
<glyph character="116" x="75" y="83" w="6" h="21" shift="7" offset="2"/>
<glyph character="117" x="205" y="29" w="8" h="22" shift="10" offset="2"/>
<glyph character="118" x="51" y="56" w="8" h="21" shift="9" offset="2"/>
<glyph character="119" x="120" y="2" w="11" h="21" shift="12" offset="2"/>
<glyph character="120" x="161" y="56" w="8" h="21" shift="8" offset="1"/>
<glyph character="121" x="166" y="2" w="9" h="25" shift="9" offset="0"/>
<glyph character="122" x="91" y="56" w="8" h="21" shift="8" offset="1"/>
<glyph character="123" x="245" y="56" w="6" h="25" shift="6" offset="1"/>
<glyph character="124" x="121" y="83" w="4" h="25" shift="6" offset="2"/>
<glyph character="125" x="235" y="29" w="7" h="25" shift="6" offset="0"/>
<glyph character="126" x="65" y="83" w="8" h="16" shift="9" offset="1"/>
</glyphs>
<kerningPairs/>
<image>fnt_nsfs_demo.png</image>
</font>

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,201 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
<spriteName>&lt;undefined&gt;</spriteName>
<solid>0</solid>
<visible>-1</visible>
<depth>0</depth>
<persistent>0</persistent>
<parentName>&lt;undefined&gt;</parentName>
<maskName>&lt;undefined&gt;</maskName>
<events>
<event eventtype="0" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>r = "";
inputs = ds_map_create();
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="3" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string></string>
</argument>
</arguments>
</action>
</event>
<event eventtype="8" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>draw_set_font(fnt_nsfs_demo);
draw_set_color(c_white);
dx = 10;
dy = 10;
dw = 200;
dh = 28;
var s, r = undefined, q;
__button = undefined;
if (demo_button("Extension' page")) url_open("https://yellowafterlife.itch.io/gamemaker-nsfs");
if (demo_button("Extension' manual")) url_open("https://yal.cc/r/17/nsfs");
if (demo_button("file_exists_ns")) r = file_exists_ns(demo_prompt("Absolute path?"));
if (demo_button("file_copy_ns")) {
s = demo_prompt("From-path?");
r = demo_status(file_copy_ns(s, demo_prompt("To-path?")));
}
if (demo_button("file_move_ns")) {
s = demo_prompt("From-path?");
r = demo_status(file_move_ns(s, demo_prompt("To-path?")));
}
if (demo_button("file_rename_ns")) {
s = demo_prompt("From-path?");
r = demo_status(file_rename_ns(s, demo_prompt("To-path?")));
}
if (demo_button("file_delete_ns")) {
s = demo_prompt("Absolute path? (note: the file will be deleted!)")
r = demo_status(file_delete_ns(s));
}
//
if (demo_button("directory_exists_ns")) {
s = demo_prompt("Absolute path?")
r = demo_status(directory_exists_ns(s));
}
if (demo_button("directory_copy_ns")) {
s = demo_prompt("From-path?");
r = demo_status(directory_copy_ns(s, demo_prompt("To-path?")));
}
if (demo_button("directory_move_ns")) {
s = demo_prompt("From-path?");
r = demo_status(directory_move_ns(s, demo_prompt("To-path?")));
}
if (demo_button("directory_rename_ns")) {
s = demo_prompt("From-path?");
r = demo_status(directory_rename_ns(s, demo_prompt("To-path?")));
}
if (demo_button("directory_delete_ns")) {
s = demo_prompt("Absolute path? (note: the directory will be deleted!)");
r = demo_status(directory_delete_ns(s));
}
//
if (demo_button("file_find_*_ns")) {
s = demo_prompt("Absolute filter path (e.g. `C:/Some/*.*`)?");
s = file_find_first_ns(s);
r = "";
while (s != "") {
r += chr(13) + chr(10) + demo_sfmt("%: %KB", s, file_find_size_ns() / 1024);
s = file_find_next_ns();
}
file_find_close_ns();
}
//
if (false &amp;&amp; demo_button("file_get_size_ns")) {
s = demo_prompt("Absolute path?");
r = demo_sfmt("%KB", file_get_size_ns(s) / 1024);
}
if (demo_button("file_text_open_read_ns")) {
s = demo_prompt("Absolute path?");
q = file_text_open_read_ns(s, demo_param("Codepage? (-1 for UTF-8)", -1));
if (q &gt;= 0) {
r = "";
while (!file_text_eof_ns(q)) {
r += chr(13) + chr(10) + file_text_read_line_ns(q);
}
file_text_close_ns(q);
} else r = "Couldn't read the file, error code " + string(nsfs_status);
}
if (demo_button("file_text_open_write_ns")) {
s = demo_prompt("Absolute path?");
q = file_text_open_write_ns(s, demo_param("Codepage? (-1 for UTF-8)", -1));
if (q &gt;= 0) {
file_text_write_line_ns(q, demo_prompt("File content?"));
file_text_close_ns(q);
r = "OK!";
} else r = "Couldn't write the file, error code " + string(nsfs_status);
}
if (demo_button("file_text_open_append_ns")) {
s = demo_prompt("Absolute path?");
q = file_text_open_append_ns(s, demo_param("Codepage? (-1 for UTF-8)", -1));
if (q &gt;= 0) {
file_text_write_line_ns(q, demo_prompt("File content?"));
file_text_close_ns(q);
r = "OK!";
} else r = "Couldn't write the file, error code " + string(nsfs_status);
}
//
if (demo_button("buffer_load_ns")) {
q = buffer_load_ns(demo_prompt("Absolute path?"));
if (q &gt;= 0) {
r = string(buffer_get_size(q)) + " bytes";
buffer_delete(q);
} else r = "Couldn't read the file, error code " + string(nsfs_status);
}
//
if (demo_button("string_codepage")) {
s = demo_prompt("String content?");
q = demo_param("String' codepage? (-1 for UTF-8)", -1);
r = string_codepage(s, q, demo_param("Target' codepage? (-1 for UTF-8)", -1));
}
//
if (!is_undefined(__button) &amp;&amp; !is_undefined(r)) show_message("Result: " + string(r));
</string>
</argument>
</arguments>
</action>
</event>
</events>
<PhysicsObject>0</PhysicsObject>
<PhysicsObjectSensor>0</PhysicsObjectSensor>
<PhysicsObjectShape>0</PhysicsObjectShape>
<PhysicsObjectDensity>0.5</PhysicsObjectDensity>
<PhysicsObjectRestitution>0.100000001490116</PhysicsObjectRestitution>
<PhysicsObjectGroup>0</PhysicsObjectGroup>
<PhysicsObjectLinearDamping>0.100000001490116</PhysicsObjectLinearDamping>
<PhysicsObjectAngularDamping>0.100000001490116</PhysicsObjectAngularDamping>
<PhysicsObjectFriction>0.200000002980232</PhysicsObjectFriction>
<PhysicsObjectAwake>-1</PhysicsObjectAwake>
<PhysicsObjectKinematic>0</PhysicsObjectKinematic>
<PhysicsShapePoints/>
</object>

View File

@ -0,0 +1,65 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<room>
<caption></caption>
<width>320</width>
<height>544</height>
<vsnap>32</vsnap>
<hsnap>32</hsnap>
<isometric>0</isometric>
<speed>30</speed>
<persistent>0</persistent>
<colour>12951176</colour>
<showcolour>-1</showcolour>
<code></code>
<enableViews>0</enableViews>
<clearViewBackground>-1</clearViewBackground>
<clearDisplayBuffer>-1</clearDisplayBuffer>
<makerSettings>
<isSet>-1</isSet>
<w>1024</w>
<h>600</h>
<showGrid>-1</showGrid>
<showObjects>-1</showObjects>
<showTiles>-1</showTiles>
<showBackgrounds>-1</showBackgrounds>
<showForegrounds>-1</showForegrounds>
<showViews>0</showViews>
<deleteUnderlyingObj>0</deleteUnderlyingObj>
<deleteUnderlyingTiles>-1</deleteUnderlyingTiles>
<page>3</page>
<xoffset>-37</xoffset>
<yoffset>15</yoffset>
</makerSettings>
<backgrounds>
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
</backgrounds>
<views>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="1024" hview="768" xport="0" yport="0" wport="1024" hport="768" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="1024" hview="768" xport="0" yport="0" wport="1024" hport="768" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="1024" hview="768" xport="0" yport="0" wport="1024" hport="768" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="1024" hview="768" xport="0" yport="0" wport="1024" hport="768" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="1024" hview="768" xport="0" yport="0" wport="1024" hport="768" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="1024" hview="768" xport="0" yport="0" wport="1024" hport="768" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="1024" hview="768" xport="0" yport="0" wport="1024" hport="768" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="1024" hview="768" xport="0" yport="0" wport="1024" hport="768" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
</views>
<instances>
<instance objName="obj_nsfs_demo" x="0" y="0" name="inst_F55A924E" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
</instances>
<tiles/>
<PhysicsWorld>0</PhysicsWorld>
<PhysicsWorldTop>0</PhysicsWorldTop>
<PhysicsWorldLeft>0</PhysicsWorldLeft>
<PhysicsWorldRight>1024</PhysicsWorldRight>
<PhysicsWorldBottom>768</PhysicsWorldBottom>
<PhysicsWorldGravityX>0</PhysicsWorldGravityX>
<PhysicsWorldGravityY>10</PhysicsWorldGravityY>
<PhysicsWorldPixToMeters>0.100000001490116</PhysicsWorldPixToMeters>
</room>

View File

@ -0,0 +1,23 @@
var mx = mouse_x - dx, my = mouse_y - dy;
var mw = dw - 2, mh = dh - 2;
var mq = mx >= 0 && my >= 0 && mx < mw && my < mh;
var r = mq && mouse_check_button_released(mb_left);
var s = argument0;
draw_sprite_stretched_ext(spr_nsfs_demo_white32, 0, dx, dy, mw, mh, -1, 0.1 + mq * 0.2);
draw_set_color(0);
draw_set_alpha(0.3);
draw_text(dx + 3, dy + 1, s);
draw_set_color(-1);
draw_set_alpha(1);
draw_text(dx + 2, dy, argument0);
//
dy += dh;
if (dy >= room_height - dh) {
dy -= floor(dy / dh) * dh;
dx += dw;
}
if (r) {
__button = s;
if (!ds_map_exists(inputs, s)) inputs[?s] = ds_map_create();
return true;
} else return false;

View File

@ -0,0 +1,7 @@
var q = inputs[?__button];
var s = argument0;
var d = q[?s];
if (is_undefined(d)) d = argument1;
var r = get_integer(s, d);
if (r != d) q[?s] = r;
return r;

View File

@ -0,0 +1,7 @@
var q = inputs[?__button];
var s = argument0;
var d = q[?s];
if (is_undefined(d)) d = "";
var r = get_string(s, d);
if (r != "") q[?s] = r;
return r;

View File

@ -0,0 +1,11 @@
/// sfmt(format, ...)
// ("%/%", 1, 2) -> "1/2"
var s = argument[0], r = "", i = 0;
repeat (argument_count - 1) {
var p = string_pos("%", s);
if (p > 0) {
r += string_copy(s, 1, p - 1) + string(argument[++i]);
s = string_copy(s, p + 1, string_length(s) - p);
} else show_error("sfmt: argument/format count mismatch", false);
}
return r + s;

View File

@ -0,0 +1,5 @@
if (argument0) {
return "Success.";
} else {
return "Failure, error code " + string(nsfs_status);
}

View File

@ -0,0 +1 @@
show_debug_message(argument0);

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 B

View File

@ -0,0 +1,25 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<sprite>
<type>0</type>
<xorig>0</xorig>
<yorigin>0</yorigin>
<colkind>1</colkind>
<coltolerance>0</coltolerance>
<sepmasks>0</sepmasks>
<bboxmode>0</bboxmode>
<bbox_left>0</bbox_left>
<bbox_right>31</bbox_right>
<bbox_top>0</bbox_top>
<bbox_bottom>31</bbox_bottom>
<HTile>0</HTile>
<VTile>0</VTile>
<TextureGroups>
<TextureGroup0>0</TextureGroup0>
</TextureGroups>
<For3D>0</For3D>
<width>32</width>
<height>32</height>
<frames>
<frame index="0">images\spr_nsfs_demo_white32_0.png</frame>
</frames>
</sprite>

View File

@ -0,0 +1,502 @@
<html><head>
<title>NSFS cheat sheet</title>
<style type="text/css">
html {
background-color: #f9f9f9;
}
body {
font: 15px 'Open Sans', sans-serif;
max-width: 640px;
background: #ffffff;
margin: 0 auto;
padding: 8px;
box-shadow: 0 0 0 2px #eee;
}
tt {
font-size: 85%;
font-family: Consolas, monospace;
background: #fff9f0;
padding: 0 3px;
box-shadow: 0 1px 2px rgba(0,0,0, 0.2);
}
#doc, #doc ul {
list-style: none;
padding-left: 0;
}
#doc div > ul {
list-style-type: disc;
padding-left: 30px ;
}
#doc h3 {
margin: 0;
font-weight: 700;
font-size: 100%;
color: #458;
border-left: 2px solid #f3f3f3;/* #f9f9f9*/
padding-left: 4px;
padding-top: 1px;
padding-bottom: 1px;
cursor: pointer;
}
#doc h3::before {
display: inline-block;
content: "+";
font: 12px monospace;
border: 1px solid #458;
line-height: 11px;
height: 11px;
width: 11px;
text-align: center;
border-radius: 50%;
margin-right: 4px;
vertical-align: middle;
position: relative;
top: -1px;
}
#doc li.open > h3::before {
content: "-";
}
#doc h4 {
border-left: none;
padding: 0;
}
#doc h3:hover, #doc h4:hover {
border-left-color: #f3f3f3;
background: #f3f3f3;
}
#doc div:not(.gminfo), #doc ul {
padding-left: 20px;
border-left: 2px solid #f3f3f3;
}
#doc .colors > span {
display: inline-block;
width: 16px;
text-indent: -9999px;
box-shadow: 0 0 1px rgba(0, 0, 0.25);
}
#doc pre, #doc tt {
font-family: Consolas, Dejavu Sans Mono, Segoe UI Mono, Ubuntu Mono, Lucida Console, monospace;
}
#doc pre {
font-size: 9pt;
line-height: 1.25;
background: white;
/*border: 1px solid #d0d0d0;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);*/
padding: 4px 2px 4px 10px;
margin: 0;
tab-size: 4;
overflow-x: auto;
}
/* delay display until load */
#doc { display: none; }
#doc li:not(.open) > div, #doc li:not(.open) > ul {
display: none;
}
</style>
<style type="text/css">
/* Code ahead */
.gminfo .code.mono {
font-family: Consolas, monospace;
font-size: 12px;
line-height: 1.25;
margin: 0;
}
.gminfo .action > .code.mono {
margin-left: 28px;
}
/** */
.gminfo .code .kw, .gminfo .code .sp {
color: #008;
font-weight: bold;
}
/** comments */
.gminfo .code .co { color: #888; }
/** numbers */
.gminfo .code .nu { color: #00F; }
.gminfo .code .nx { color: #00F; }
/** strings */
.gminfo .code .st { color: #00F; }
/** resource indexes */
.gminfo .code .ri { color: rgb(0, 120, 170); }
/** standard/built-in variable */
.gminfo .code .sv { color: #800; }
/** standard/built-in function */
.gminfo .code .sf { color: #800; }
/** user-defined variable name */
.gminfo .code .uv { color: #408; }
/** user-defined script/function */
.gminfo .code .uf { color: #808; }
/** user-defined field (inst.field) */
.gminfo .code .fd { color: #408; }
</style>
<noscript><style>
#doc h3::before {
display: none;
}
#doc h3:hover {
border-left-color: inherit;
background: inherit;
}
#doc { display: inherit }
#doc li > div, #doc li > ul {
display: inherit;
}
</style></noscript>
</head><body>
This is a "cheat sheet" for Non-Sandboxed FileSystem extension by YellowAfterlife.<br>
The extension can be acquired from <a href="https://marketplace.yoyogames.com/assets/5172/non-sandboxed-filesystem">GM:Marketplace</a> or <a href="https://yellowafterlife.itch.io/gamemaker-nsfs">itch.io</a>.<br>
For questions/support, use <a href="https://forum.yoyogames.com/index.php?threads/non-sandboxed-filesystem-access.21643/">forums</a>, or <a href="mailto://yellowafterlife@hotmail.com">send me an email</a>.<br>
The extension is currently available for Windows (is a DLL).<br>
<br>
Click on sections to expand/collapse them.<br>
Quick display controls: <a href="#" onclick="opt_none()">Categories</a>
&middot; <a href="#" onclick="opt_list()">Functions</a>
&middot; <a href="#" onclick="opt_all()">Everything</a>
<ul id="doc">
<li><h3>General functions</h3><ul>
<li><h3>nsfs_is_available</h3><div>
This variable holds status (<tt>true</tt>\<tt>false</tt>) of whether the native extension for NSFS was successfully loaded. The extension may not be loaded in a few cases:
<ul><li>
Extension is not supported on the target platform.
</li><li>
Extension' file is amiss (e.g. the user did not unzip the game before running).
</li></ul>
As per GameMaker rules, all calls to unavailable extensions return <tt>0</tt> instead, so you may want to check this and notify the user prior to performing any operations.
</div></li>
<li><h3 id="nsfs_status">nsfs_status</h3><div>
Some functions provide additional feedback aside of usual success/failure result.<br>
In those cases, when the result is <tt>false</tt>, this global variable holds the status/error code that can be used for troubleshooting the issue.<br>
On Windows, values are as per <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx">System Error Codes</a> reference.
</div></li>
<li><h3>nsfs_set_directory(new_working_directory)</h3><div>
By default, when a relative path is specified, NSFS will read/write files in game's program directory. If you want to use some other directory instead (e.g. <a href="http://docs.yoyogames.com/source/dadiospice/002_reference/file%20handling/file%20system%20limits.html">save directory</a>), you can use this function to change the extension's working directory.<br>
The function returns whether the working directory was successfully changed;
<a href="#nsfs_status">nsfs_status</a> contains the error code if it couldn't be.<br>
One of the few reasons to failure of this function is the target directory not being a valid path (use <a href="http://docs.yoyogames.com/source/dadiospice/002_reference/file%20handling/directory_exists.html">directory_exists</a>\<a href="#directory_exists_ns">directory_exists_ns</a> to check).
</div></li>
<li><h3>nsfs_get_directory()</h3><div>
Returns the extension's working directory.<br>
If that somehow fails, returns an empty string and sets <a href="#nsfs_status">nsfs_status</a>.
</div></li>
</ul></li>
<li><h3>File manipulation functions</h3><ul>
<li><h3>file_exists_ns(path)</h3><div>
Returns whether the file exists at the given path.<br>
Returns <tt>false</tt> if there's a directory of the same name at the path.
</div></li>
<li><h3 id="file_copy_ns">file_copy_ns(oldpath, newpath)</h3><div>
Copies a file between locations, returns whether successful.<br>
In case of failure, <a href="#nsfs_status">nsfs_status</a> contains the error code.
</div></li>
<li><h3>file_rename_ns(oldname, newname)</h3><div>
Renames a file, returns whether successful.<br>
Note that if the <tt>oldname</tt> contains a path, <tt>newname</tt> should as well.<br>
In case of failure, <a href="#nsfs_status">nsfs_status</a> contains the error code.
</div></li>
<li><h3>file_move_ns(oldpath, newpath)</h3><div>
Moves a file to a different location, returns whether successful.<br>
In case of failure, <a href="#nsfs_status">nsfs_status</a> contains the error code.
</div></li>
<li><h3>file_delete_ns(path)</h3><div>
Deletes a file, returns whether successful.<br>
In case of failure, <a href="#nsfs_status">nsfs_status</a> contains the error code.<br>
Note that you can't remove files currently in use by an application (incl. yours).
</div></li>
</ul></li>
<li><h3>Directory manipulation functions</h3><ul>
<li><h3>directory_exists_ns(path)</h3><div>
Returns whether the file exists at the given path.<br>
Returns <tt>false</tt> if there's a directory of the same name at the path.
</div></li>
<li><h3 id="directory_copy_ns">directory_copy_ns(oldpath, newpath)</h3><div>
Copies a directory between locations, returns whether successful.<br>
In case of failure, <a href="#nsfs_status">nsfs_status</a> contains the error code.
</div></li>
<li><h3>directory_rename_ns(oldname, newname)</h3><div>
Renames a directory, returns whether successful.<br>
Note that if the <tt>oldname</tt> contains a path, <tt>newname</tt> should as well.<br>
In case of failure, <a href="#nsfs_status">nsfs_status</a> contains the error code.<br>
Directories cannot be renamed if some of their files are currently in use by applications (incl. yours).
</div></li>
<li><h3>directory_move_ns(oldpath, newpath)</h3><div>
Moves a directory to a different location, returns whether successful.<br>
In case of failure, <a href="#nsfs_status">nsfs_status</a> contains the error code.<br>
Directories cannot be moved if some of their files are currently in use by applications (incl. yours).
</div></li>
<li><h3>directory_delete_ns(path)</h3><div>
Deletes a directory, returns whether successful.<br>
In case of failure, <a href="#nsfs_status">nsfs_status</a> contains the error code.<br>
Directories cannot be deleted if some of their files are currently in use by applications (incl. yours).
</div></li>
</ul></li>
<li><h3>File/directory attribute functions</h3><ul>
<li><h3 id="file_get_attributes_ns">file_get_attributes_ns(path)</h3><div>
Returns attributes of a file/directory at given path.<br>
Returned attributes (a set of bit flags) are as per <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117(v=vs.85).aspx">MSDN specification</a>.<br>
If attributes cannot be retrieved (e.g. no object exists at path), returned value is <tt>-1</tt>, and <a href="#nsfs_status">nsfs_status</a> contains the error code.
</div></li>
<li><h3>file_set_attributes_ns(path, newattributes)</h3><div>
Changes the attributes of a file/directory at the given path, returns whether successful.
The attributes (a set of bit flags) are as per <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117(v=vs.85).aspx">MSDN specification</a>.<br>
If attributes cannot be changed, <a href="#nsfs_status">nsfs_status</a> contains the error code.
</div></li>
<li><h3>file_get_size_ns(path)</h3><div>
Returns the size of the file at given path, in bytes.<br>
If the size cannot be measured, returns -1 and sets <a href="#nsfs_status">nsfs_status</a>.
</div></li>
</ul></li>
<li><h3>File/directory search functions</h3><ul>
<li><h3 id="file_find_first_ns">file_find_first_ns(mask)</h3><div>
Begins the search for files/directories matching the given mask and returns the first result.
Returns "" and sets <a href="#nsfs_status">nsfs_status</a> if nothing can be found.<br>
This is much akin to <a href="http://docs.yoyogames.com/source/dadiospice/002_reference/file%20handling/file%20system/file_find_first.html">file_find_first</a>, but with one remark: instead of taking attributes as a second parameter (which gives very limited freedom to filtering results), there is a <a href="#file_find_attributes_ns">file_find_attributes_ns</a> function that returns the attributes of the current file in search.<br>
For example, if you wanted to pick through just files (no directories) in <tt>maps</tt> subdirectory in game's directory, you would do that like so:
<div class="gminfo"><pre class="code mono">
<span class="kw">for</span> (<span class="kw">var</span> <span class="uv">f</span> <span class="op">=</span> <span class="sf">file_find_first_ns</span>(<span class="st">"maps/*.*"</span>); <span class="uv">f</span> <span class="op">!=</span> <span class="st">""</span>; <span class="uv">f</span> <span class="op">=</span> <span class="sf">file_find_next_ns</span>()) {
<span class="kw">if</span> (<span class="sf">file_find_attributes_ns</span>() <span class="op">&amp;</span> <span class="sv">fa_directory</span>) <span class="kw">continue</span>;
<span class="co">// file is not a directory - do something here</span>
<span class="sf">show_debug_message</span>(<span class="uv">f</span> <span class="op">+</span> <span class="st">": "</span> <span class="op">+</span> <span class="sf">string</span>(<span class="sf">file_find_size_ns</span>() <span class="op">/</span> <span class="nu">1024</span>) <span class="op">+</span> <span class="st">"KB"</span>);
}
<span class="sf">file_find_close</span>();
</pre></div>
which would display results like <tt>some.map</tt> (given <tt>maps/some.map</tt>).
</div></li>
<li><h3>file_find_next_ns()</h3><div>
Returns the next result matching the mask (from <a href="#file_find_first_ns">file_find_first_ns</a>).<br>
Returns <tt>""</tt> if there are no more results left.
</div></li>
<li><h3>file_find_close_ns()</h3><div>
Finalizes the current search and frees up the related resources.<br>
<a href="#file_find_first_ns">file_find_first_ns</a> will automatically do this prior to starting the next search if you forget, but it is recommended that you do this by yourself when a search is complete.
</div></li>
<li><h3 id="file_find_attributes_ns">file_find_attributes_ns()</h3><div>
Returns the attributes (much like <a href="#file_get_attributes_ns">file_get_attributes_ns</a>) of the current (most recently returned) file in search. Due to how file search works, this is generally faster than retrieving the attributes by absolute path.
</div></li>
<li><h3>file_find_size_ns()</h3><div>
Returns the size (in bytes) of the current (most recently returned) file in search. This is generally faster than retrieving the size by absolute path.<br>
This function considers directories to have size of 0 bytes.
</div></li>
</ul></li>
<li><h3>Text file functions</h3><ul>
<li><h3>file_text_open_read_ns(path, codepage)</h3><div>
Opens a text file at given path for reading and returns file ID.<br>
Codepage numbers can be found <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx">on MSDN</a>.<br>
<tt>-1</tt> can be specified as a codepage to use UTF-8 (GMS default).<br>
If the file cannot be opened for reading, returns <tt>-1</tt> and sets <a href="#nsfs_status">nsfs_status</a>.<br>
IDs used by these functions are separate from those used by built-in ones.
</div></li>
<li><h3>file_text_open_write_ns(path, codepage)</h3><div>
Opens a text file at given path for writing and returns file ID.<br>
If the file is already present, it is overwritten.<br>
Codepage numbers can be found <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx">on MSDN</a>.<br>
<tt>-1</tt> can be specified as a codepage to use UTF-8 (GMS default).<br>
If the file cannot be opened for writing, returns <tt>-1</tt> and sets <a href="#nsfs_status">nsfs_status</a>.
</div></li>
<li><h3>file_text_open_append_ns(path, codepage)</h3><div>
Opens a text file at given path for writing and returns file ID.<br>
If the file is already present, appends to the end of the file.<br>
Codepage numbers can be found <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx">on MSDN</a>.<br>
<tt>-1</tt> can be specified as a codepage to use UTF-8 (GMS default).<br>
If the file cannot be opened for writing, returns <tt>-1</tt> and sets <a href="#nsfs_status">nsfs_status</a>.
</div></li>
<li><h3>file_text_close_ns(file_id)</h3><div>
Closes the given text file, freeing it for operations or use by other applications.<br>
Returns whether the file was actually open (and thus could be closed).
</div></li>
<li><h3>file_text_eof_ns(file_id)</h3><div>
Returns whether end of file was reached for the given file.<br>
Only makes sense for files opened for reading.<br>
Returns <tt>true</tt> for invalid file IDs.
</div></li>
<li><h3>file_text_read_line_ns(file_id)</h3><div>
Reads and returns the next line from the given file.<br>
This is equivalent to <a href="http://docs.yoyogames.com/source/dadiospice/002_reference/file%20handling/files/file_text_read_string.html">file_text_read_string</a> + <a href="http://docs.yoyogames.com/source/dadiospice/002_reference/file%20handling/files/file_text_readln.html">file_text_readln</a>. That is, it reads and returns the text on the current line, and skips the line delimiter (CR\LF\CRLF\LFCR).<br>
Returns <tt>""</tt> if the file handle is invalid or end of file has been reached.
</div></li>
<li><h3>file_text_write_line_ns(file_id, text)</h3><div>
Writes a string to the given file, returns whether successful.<br>
Adds a linebreak (CRLF) prior to writing automatically if it is not the first line.<br>
</div></li>
</ul></li>
<li><h3>Buffer functions</h3><ul>
<li><h3>buffer_load_ns(path)</h3><div>
Loads a GM buffer from the file and returns it's ID.<br>
Is a direct equivalent of the built-in <a href="http://docs.yoyogames.com/source/dadiospice/002_reference/buffers/buffer_load.html">buffer_load</a> function.<br>
If the file cannot be read, returns <tt>-1</tt> and sets <a href="#nsfs_status">nsfs_status</a>.
</div></li>
<li><h3>buffer_save_ns(buffer, path)</h3><div>
Saves the contents of the given buffer to a file, returns whether successful.<br>
Is akin to the built-in <a href="http://docs.yoyogames.com/source/dadiospice/002_reference/buffers/buffer_save.html">buffer_save</a> function (but has a return value).<br>
If the file cannot be written, returns <tt>false</tt> and sets <a href="#nsfs_status">nsfs_status</a>.<br>
</div></li>
<li><h3>buffer_save_ext_ns(buffer, path, offset, size)</h3><div>
Saves a subsection of the given buffer to a file, returns whether successful.<br>
Is akin to the built-in <a href="http://docs.yoyogames.com/source/dadiospice/002_reference/buffers/buffer_save_ext.html">buffer_save_ext</a> function (but has a return value).<br>
If the file cannot be written, returns <tt>false</tt> and sets <a href="#nsfs_status">nsfs_status</a>.
</div></li>
</ul></li>
<li><h3>Misc functions</h3><ul>
<li><h3>string_codepage(string, oldcodepage, newcodepage)</h3><div>
Converts contents of a string between codepages.<br>
Codepage numbers can be found <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx">on MSDN</a>.<br>
<tt>-1</tt> can be specified as a codepage to use UTF-8 (GMS default).<br>
This is particularly handy if you
</div></li>
</ul></li>
<li><h3>Workarounds</h3><div>
Certain functions cannot be reasonably implemented in scope of this extension, e.g.
<ul><li>
GM:S does not allow extensions to load assets directly, meaning that they would have to be copied into an "allowed" directory by either yourself or an extension.
</li><li>
<tt>file_bin_</tt> functions are noticeably outperformed by a <tt>buffer_fast</tt> buffer, leaving little reason to reimplement them instead of using buffers.
</li></ul>
In majority of situations, the issues can be bypassed by using <a href="#file_copy_ns">file_copy_ns</a> or <a href="#directory_copy_ns">directory_copy_ns</a> accordingly.
</div></li>
<!--
<li><h3></h3><div>
</div></li>
-->
</ul> <!-- #doc -->
<script>(function() {
var doc = document.getElementById("doc");
var headers = doc.getElementsByTagName("h3");
//
var path = "cc.yal.nsfs.doc.state";
var state = null;
if (window.localStorage && JSON.parse) {
state = window.localStorage.getItem(path);
state = state ? JSON.parse(state) : { };
if (state == null) state = { };
}
//
function h3bind(h3) {
var node = h3.parentNode;
var snip = node.children[1];
h3.snip = snip;
h3.doc_set = function(z) {
if (node.classList.contains("open") == z) return;
if (z) node.classList.add("open"); else node.classList.remove("open");
if (state) {
state[h3.textContent] = z;
window.localStorage.setItem(path, JSON.stringify(state));
}
}
h3.doc_hide = function() {
this.doc_set(false);
}
h3.doc_show = function() {
this.doc_set(true);
}
h3.onclick = function(_) {
var seen = !node.classList.contains("open");
h3.doc_set(seen);
};
}
//
(function() {
for (var i = 0; i < headers.length; i++) h3bind(headers[i]);
var anchors = doc.getElementsByTagName("a");
function getHashFunc(id) {
return function(e) {
var node = document.getElementById(id);
while (node && node != doc) {
if (node.tagName == "LI") {
var h3 = node.children[0];
if (h3.doc_set) h3.doc_set(true);
}
node = node.parentElement;
}
};
}
for (var i = 0; i < anchors.length; i++) {
var anchor = anchors[i];
var href = anchor.getAttribute("href");
if (href[0] == "#") {
anchor.addEventListener("click", getHashFunc(href.substr(1)));
}
}
})();
//
window.opt_none = function() {
for (var li = 0; li < headers.length; li++) headers[li].doc_hide();
};
window.opt_list = function() {
for (var li = 0; li < headers.length; li++) {
var h3 = headers[li];
if (h3.parentNode.parentNode != doc) {
h3.doc_hide();
} else h3.doc_show();
}
};
window.opt_all = function() {
for (var li = 0; li < headers.length; li++) headers[li].doc_show();
};
//
(function() {
for (var li = 0; li < headers.length; li++) {
var h3 = headers[li];
var val = state ? state[h3.textContent] : null;
if (val == null) val = h3.parentNode.parentNode == doc;
if (val) h3.doc_show(); else h3.doc_hide();
}
})();
doc.style.display = "inherit";
})();
</script>
<!--<script type="text/javascript" src="http://livejs.com/live.js"></script>-->
</body></html>

View File

@ -0,0 +1,491 @@
/// @author YellowAfterlife
#include "stdafx.h"
#include <stdio.h>
#include <Windows.h>
#include <shellapi.h>
#include <string>
//
#define dllx extern "C" __declspec(dllexport)
#define trace(...) { printf(__VA_ARGS__); printf("\n"); fflush(stdout); }
class StringConv {
public:
char* cbuf = NULL;
size_t cbuf_size = 0;
WCHAR* wbuf = NULL;
size_t wbuf_size = 0;
StringConv() {
}
LPCWSTR wget(size_t size) {
if (wbuf_size < size) {
if (wbuf != NULL) delete wbuf;
wbuf = new WCHAR[size];
wbuf_size = size;
}
return wbuf;
}
LPCWSTR proc(char* src, int cp = CP_UTF8) {
size_t size = MultiByteToWideChar(cp, 0, src, -1, NULL, 0);
LPCWSTR buf = wget(size);
MultiByteToWideChar(cp, 0, src, -1, wbuf, size);
return wbuf;
}
char* get(size_t size) {
if (cbuf_size < size) {
if (cbuf != NULL) delete cbuf;
cbuf = new char[size];
cbuf_size = size;
}
return cbuf;
}
char* proc(LPCWSTR src, int cp = CP_UTF8) {
size_t size = WideCharToMultiByte(cp, 0, src, -1, NULL, 0, NULL, NULL);
char* buf = get(size);
WideCharToMultiByte(cp, 0, src, -1, buf, size, NULL, NULL);
return buf;
}
} c1, c2;
#pragma region Status
DWORD nsfs_status;
dllx double nsfs_get_status() {
return nsfs_status;
}
bool nsfs_ret_code(DWORD status) {
nsfs_status = status;
return status == 0;
}
bool nsfs_ret_error(BOOL status) {
if (status) {
nsfs_status = 0;
return true;
} else {
nsfs_status = GetLastError();
return false;
}
}
#pragma endregion
#pragma region Init
dllx char* nsfs_get_directory() {
static WCHAR cwd[4096];
if (GetCurrentDirectory(4096, cwd)) {
nsfs_status = 0;
return c1.proc(cwd);
} else {
nsfs_status = GetLastError();
return "";
}
}
dllx double nsfs_set_directory(char* cwd) {
return nsfs_ret_error(SetCurrentDirectory(c1.proc(cwd)));
}
dllx double nsfs_init_raw() {
nsfs_status = 0;
return 1;
}
#pragma endregion
#pragma region file_
/// returned values as per https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117(v=vs.85).aspx
dllx double file_get_attributes_ns(char* path) {
auto r = GetFileAttributes(c1.proc(path));
if (r == INVALID_FILE_ATTRIBUTES) {
nsfs_status = GetLastError();
} else nsfs_status = 0;
return r;
}
/// flags as per https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117(v=vs.85).aspx
dllx double file_set_attributes_ns(char* path, double flags) {
return nsfs_ret_error(SetFileAttributes(c1.proc(path), (DWORD)flags));
}
/// Returns size of the given file, in bytes.
dllx double file_get_size_ns(char* path) {
HANDLE h = CreateFile(c1.proc(path), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE) {
nsfs_status = GetLastError();
return -1;
}
LARGE_INTEGER lsize;
INT64 size = GetFileSizeEx(h, &lsize) ? lsize.QuadPart : -1;
CloseHandle(h);
return (double)size;
}
int file_operation(UINT wFunc, char* pFrom, char* pTo) {
// "Note: This string must be double-null terminated."
LPCWSTR wFrom = c1.proc(pFrom);
size_t lFrom = wcslen(wFrom);
LPWSTR zFrom = new WCHAR[lFrom + 2];
wcscpy(zFrom, wFrom);
zFrom[lFrom + 1] = 0;
//
LPCWSTR wTo = c2.proc(pTo);
size_t lTo = wcslen(wTo);
LPWSTR zTo = new WCHAR[lTo + 2];
wcscpy(zTo, wTo);
zTo[lTo + 1] = 0;
//
SHFILEOPSTRUCT op;
op.hwnd = nullptr;
op.wFunc = wFunc;
op.pFrom = zFrom;
op.pTo = zTo;
op.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT;
op.fAnyOperationsAborted = false;
op.hNameMappings = nullptr;
op.lpszProgressTitle = L"";
//
int r = SHFileOperation(&op);
delete zFrom;
delete zTo;
return nsfs_ret_code(r);
}
///
dllx double file_exists_ns(char* path) {
LPCWSTR wpath = c1.proc(path);
DWORD d = GetFileAttributes(wpath);
bool r = (d != INVALID_FILE_ATTRIBUTES && (d & FILE_ATTRIBUTE_DIRECTORY) == 0);
return r;
}
///
dllx double directory_exists_ns(char* path) {
LPCWSTR wpath = c1.proc(path);
DWORD d = GetFileAttributes(wpath);
bool r = (d != INVALID_FILE_ATTRIBUTES && (d & FILE_ATTRIBUTE_DIRECTORY) != 0);
return r;
}
///
dllx double file_delete_ns(char* path) {
LPCWSTR wpath = c1.proc(path);
DWORD attr = GetFileAttributes(wpath);
if (attr != INVALID_FILE_ATTRIBUTES) {
if (attr & FILE_ATTRIBUTE_READONLY) {
SetFileAttributes(wpath, attr & (FILE_ATTRIBUTE_READONLY));
}
return DeleteFile(c1.proc(path));
}
return false;
}
///
dllx double directory_delete_ns(char* path) {
return file_operation(FO_DELETE, path, "");
}
///
dllx double file_copy_ns(char* from, char* to) {
return nsfs_ret_error(CopyFile(c1.proc(from), c2.proc(to), false));
}
///
dllx double directory_copy_ns(char* from, char* to) {
return file_operation(FO_COPY, from, to);
}
///
dllx double file_rename_ns(char* from, char* to) {
return file_operation(FO_RENAME, from, to);
}
///
dllx double directory_rename_ns(char* from, char* to) {
return file_operation(FO_RENAME, from, to);
}
///
dllx double file_move_ns(char* from, char* to) {
return file_operation(FO_MOVE, from, to);
}
///
dllx double directory_move_ns(char* from, char* to) {
return file_operation(FO_MOVE, from, to);
}
#pragma endregion
#pragma region file_find
HANDLE file_find_handle = INVALID_HANDLE_VALUE;
WIN32_FIND_DATA file_find_data;
///
dllx char* file_find_first_ns(char* mask) {
if (file_find_handle != INVALID_HANDLE_VALUE) FindClose(file_find_handle);
file_find_handle = FindFirstFile(c1.proc(mask), &file_find_data);
if (file_find_handle != INVALID_HANDLE_VALUE) {
nsfs_status = 0;
return c1.proc(file_find_data.cFileName);
} else {
nsfs_status = GetLastError();
return "";
}
}
///
dllx char* file_find_next_ns() {
if (file_find_handle != INVALID_HANDLE_VALUE) {
if (FindNextFile(file_find_handle, &file_find_data) != 0) {
return c1.proc(file_find_data.cFileName);
}
}
return "";
}
///
dllx double file_find_close_ns() {
if (file_find_handle != INVALID_HANDLE_VALUE) {
return FindClose(file_find_handle);
} else return false;
}
/// Returns the attributes of the current file in file_find
dllx double file_find_attributes_ns() {
return file_find_data.dwFileAttributes;
}
/// Returns the size (in bytes) of the current file in file_find
dllx double file_find_size_ns() {
return (double)((UINT64)file_find_data.nFileSizeLow | ((UINT64)file_find_data.nFileSizeHigh << 32));
}
#pragma endregion
#pragma region file_text
const int file_text_num = 32;
struct file_text_t {
int mode = 0;
HANDLE file = INVALID_HANDLE_VALUE;
long size;
bool eof;
int codepage;
} file_text[file_text_num];
int file_text_alloc_index() {
for (int i = 0; i < file_text_num; i++) {
if (file_text[i].mode == 0) return i;
}
return -1;
}
/// Codepage can be set to -1 for default (UTF-8)
dllx double file_text_open_read_ns(char* path, double codepage) {
int i = file_text_alloc_index();
if (i < 0) return -1;
//
HANDLE file = CreateFile(c1.proc(path),
GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (file != INVALID_HANDLE_VALUE) {
file_text_t* next = &file_text[i];
next->mode = 1;
next->file = file;
next->size = GetFileSize(file, 0);
next->eof = next->size == 0;
int cp = (int)codepage;
if (cp == -1) cp = CP_UTF8;
next->codepage = cp;
nsfs_status = 0;
return i;
} else {
nsfs_status = GetLastError();
return -1;
}
}
/// Codepage can be set to -1 for default (UTF-8)
dllx double file_text_open_write_ns(char* path, double codepage) {
int i = file_text_alloc_index();
if (i < 0) return -1;
//
HANDLE file = CreateFile(c1.proc(path),
GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
if (file != INVALID_HANDLE_VALUE) {
file_text_t* next = &file_text[i];
next->mode = 2;
next->file = file;
next->size = -1;
next->eof = false;
int cp = (int)codepage;
if (cp == -1) cp = CP_UTF8;
next->codepage = cp;
nsfs_status = 0;
return i;
} else {
nsfs_status = GetLastError();
return -1;
}
}
/// Codepage can be set to -1 for default (UTF-8)
dllx double file_text_open_append_ns(char* path, double codepage) {
int i = file_text_alloc_index();
if (i < 0) return -1;
//
HANDLE file = CreateFile(c1.proc(path),
FILE_APPEND_DATA, FILE_SHARE_READ, NULL, OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
if (file != INVALID_HANDLE_VALUE) {
file_text_t* next = &file_text[i];
next->mode = 2;
next->file = file;
next->size = SetFilePointer(file, 0, NULL, FILE_END);
if (next->size == 0) next->size = -1;
next->eof = false;
int cp = (int)codepage;
if (cp == -1) cp = CP_UTF8;
next->codepage = cp;
nsfs_status = 0;
return i;
} else {
nsfs_status = GetLastError();
return -1;
}
}
///
dllx double file_text_close_ns(double fileid) {
int i = (int)fileid;
if (i >= 0 && i < file_text_num) {
file_text_t* f = &file_text[i];
if (f->mode != 0) {
if (CloseHandle(f->file)) {
f->file = INVALID_HANDLE_VALUE;
f->mode = 0;
return true;
}
}
}
return false;
}
///
dllx double file_text_eof_ns(double fileid) {
int i = (int)fileid;
if (i >= 0 && i < file_text_num) {
file_text_t* f = &file_text[i];
if (f->mode != 0) {
return f->eof;
}
}
return true;
}
/// Reads the next line from a file, skips line separators after it.
dllx char* file_text_read_line_ns(double fileid) {
int i = (int)fileid;
if (i >= 0 && i < file_text_num) {
file_text_t* f = &file_text[i];
if ((f->mode & 1) && !f->eof) {
HANDLE q = file_text[i].file;
BYTE next; DWORD length = 0, read; bool eof = false;
for (;;) {
ReadFile(q, &next, 1, &read, NULL);
if (read > 0) {
if (next == '\r' || next == '\n') {
break;
} else length += 1;
} else {
eof = true;
break;
}
}
//
char* out = c1.get(length + 1);
out[length] = 0;
SetFilePointer(q, -(long)length - (eof ? 0 : 1), NULL, FILE_CURRENT);
ReadFile(q, out, length, &read, NULL);
int cp = f->codepage;
if (cp != CP_UTF8) {
LPCWSTR wide = c1.proc(out, cp);
out = c1.proc(wide);
}
if (!eof) {
ReadFile(q, &next, 1, &read, NULL);
BYTE other = next == '\r' ? '\n' : '\r';
ReadFile(q, &next, 1, &read, NULL);
if (read > 0) {
if (next != other) {
SetFilePointer(q, -1, NULL, FILE_CURRENT);
}
} else f->eof = true;
} else f->eof = true;
//
return out;
}
}
return "";
}
char* file_text_linebreak = "\r\n";
/// Writes a line and line separators into a file.
dllx double file_text_write_line_ns(double fileid, char* text) {
int i = (int)fileid;
if (i >= 0 && i < file_text_num) {
file_text_t* ft = &file_text[i];
if (ft->mode & 2) {
HANDLE f = ft->file;
DWORD written;
if (ft->size >= 0) {
WriteFile(f, file_text_linebreak, 2, &written, NULL);
ft->size += written;
} else ft->size = 0;
int cp = ft->codepage;
if (cp != CP_UTF8) {
LPCWSTR wide = c1.proc(text);
text = c1.proc(wide, cp);
}
int size = strlen(text);
WriteFile(f, text, size, &written, NULL);
ft->size += written;
return true;
}
}
return false;
}
#pragma endregion
#pragma region buffer_
HANDLE buffer_load_file = INVALID_HANDLE_VALUE;
dllx double buffer_load_ns_raw1(char* path) {
buffer_load_file = CreateFile(c1.proc(path),
GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (buffer_load_file != INVALID_HANDLE_VALUE) {
nsfs_status = 0;
return GetFileSize(buffer_load_file, 0);
} else {
nsfs_status = GetLastError();
return -1;
}
}
dllx double buffer_load_ns_raw2(char* cbuf, double len) {
if (buffer_load_file != INVALID_HANDLE_VALUE) {
// ReadFile(q, &next, 1, &read, NULL);
DWORD read;
ReadFile(buffer_load_file, cbuf, (DWORD)len, &read, NULL);
CloseHandle(buffer_load_file);
buffer_load_file = INVALID_HANDLE_VALUE;
return read;
} else return -1;
}
dllx double buffer_save_ns_raw(char* cbuf, char* path, double len) {
HANDLE file = CreateFile(c1.proc(path),
GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
if (file != INVALID_HANDLE_VALUE) {
DWORD r = 0;
WriteFile(file, cbuf, (DWORD)len, &r, NULL) ? r : -1;
CloseHandle(file);
nsfs_status = 0;
return r;
} else {
nsfs_status = GetLastError();
return -1;
}
}
#pragma endregion
#pragma region string
/// Converts a string between codepages. From/to can be set to -1 for UTF-8
dllx char* string_codepage(char* str, double codepage_from, double codepage_to) {
int cp0 = (int)codepage_from; if (cp0 == -1) cp0 = CP_UTF8;
int cp1 = (int)codepage_to; if (cp1 == -1) cp1 = CP_UTF8;
return c1.proc(c1.proc(str, cp0), cp1);
}
#pragma endregion

Binary file not shown.

View File

@ -0,0 +1,34 @@
#define nsfs_init
/// ()
//#global nsfs_is_available:
//#nsfs_status = nsfs_get_status():
nsfs_is_available = nsfs_init_raw();
#define buffer_load_ns
/// (path):
var n = buffer_load_ns_raw1(argument0), r;
if (n >= 0) {
if (n == 0) { // bug: GMS does not allow to create zero-size buffers.
r = buffer_create(1, buffer_fixed, 1);
buffer_resize(r, 0);
} else r = buffer_create(n, buffer_fixed, 1);
buffer_load_ns_raw2(buffer_get_address(r), n);
return r;
} else return -1;
#define buffer_save_ns
/// (buffer, path):
var b = argument0;
return buffer_save_ns_raw(buffer_get_address(b), argument1, buffer_get_size(b));
#define buffer_save_ext_ns
/// (buffer, path, offset, size):
var b = argument0;
var m = buffer_get_size(b);
var i = argument2;
var n = clamp(i + argument3, 0, m);
i = clamp(i, 0, m);
n -= i;
if (n > 0) {
return buffer_save_ns_raw(buffer_get_address(b) + i, argument1, n);
} else return -1;

View File

@ -35,7 +35,9 @@ enum dex
form,
type1,
type2,
sprite
boxable,
sprite,
own
}
global.dexdata = csv_load("pokedata");
@ -80,6 +82,46 @@ global.selected[dex.form] = "";
global.selected[dex.type1] = "Grass";
global.selected[dex.type2] = "Poison";
global.selected[dex.sprite] = -1;
global.selected[dex.own] = 0;
global.dex_len = array_height_2d(global.dexdata);
</string>
</argument>
</arguments>
</action>
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>/// SAVE DATA
if (file_exists("save.ini"))
{
ini_open("save.ini")
for (var i=0; i&lt;=global.dex_len; i++)
global.savedata[i] = ini_read_real("Pokemon", string(i), 0);
ini_close();
show_debug_message("LOADED SAVE FILE.");
}
else
{
ini_open("save.ini");
ini_write_real("Version", "Number", 0.1);
ini_close();
show_debug_message("CREATED SAVE FILE.");
}
</string>
</argument>
</arguments>
@ -118,12 +160,13 @@ for (var i=0; i&lt;100; i++)
pokemon = global.dexdata[global.current, dex.pokemon];
form = global.dexdata[global.current, dex.form];
type1 = global.dexdata[global.current, dex.type1];
//type2 = global.dexdata[global.current, dex.type2];
type2 = global.dexdata[global.current, dex.type2];
own = false;
own = global.savedata[global.current];
color = get_color3(own, false);
image_speed = 0;
color = c_white;
hover = false;
spr = sprite_add("Icons\Regular\"+string(pokemon)+".png",0,true,false,19,14);
@ -137,6 +180,46 @@ for (var i=0; i&lt;100; i++)
</argument>
</arguments>
</action>
<action>
<libid>1</libid>
<id>601</id>
<kind>0</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>1</exetype>
<functionname>action_execute_script</functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>9</kind>
<script>scr_window_resize</script>
</argument>
<argument>
<kind>0</kind>
<string></string>
</argument>
<argument>
<kind>0</kind>
<string></string>
</argument>
<argument>
<kind>0</kind>
<string></string>
</argument>
<argument>
<kind>0</kind>
<string></string>
</argument>
<argument>
<kind>0</kind>
<string></string>
</argument>
</arguments>
</action>
</event>
<event eventtype="3" enumb="0">
<action>
@ -179,6 +262,49 @@ for (var i=0; i&lt;100; i++)
</argument>
</arguments>
</action>
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>global.box_scale = sprite_get_width(spr_slot)*global.icon_scale;
</string>
</argument>
</arguments>
</action>
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>/// WINDOW RESIZE CHECK
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="8" enumb="0">
<action>
@ -197,17 +323,28 @@ for (var i=0; i&lt;100; i++)
<arguments>
<argument>
<kind>1</kind>
<string>var len = global.box_len/8;
<string>color = get_color3(global.selected[dex.own], false);
draw_set_color(color);
/// DRAW HOVER INFO
var len = global.box_len/8;
var hal = len/2;
var mid = room_width*0.75;
draw_set_font(global.font)
draw_set_halign(fa_middle)
draw_text_transformed(room_width*0.75, room_height*0.1, global.selected[dex.dexno], len, len, 0);
draw_text_transformed(room_width*0.75, room_height*0.5, global.selected[dex.pokemon], len, len, 0);
draw_text_transformed(mid, room_height*0.1, scr_zeros(global.selected[dex.dexno]), len, len, 0);
draw_text_transformed(mid, room_height*0.5, global.selected[dex.pokemon], len, len, 0);
draw_set_color(c_white);
if (global.selected[dex.type2] != "")
{
draw_sprite_ext(spr_type, scr_typeget(global.selected[dex.type1]), room_width*0.75-(30*len/2)-len/2, room_height*0.6, len/2, len/2, image_angle, image_blend, image_alpha);
draw_sprite_ext(spr_type, scr_typeget(global.selected[dex.type2]), room_width*0.75+len/2, room_height*0.6, len/2, len/2, image_angle, image_blend, image_alpha);
draw_sprite_ext(spr_type, scr_typeget(global.selected[dex.type1]), mid-(30*hal)-hal, room_height*0.6, hal, hal, image_angle, image_blend, image_alpha);
draw_sprite_ext(spr_type, scr_typeget(global.selected[dex.type2]), mid+hal, room_height*0.6, hal, hal, image_angle, image_blend, image_alpha);
}
else
{
}
</string>
</argument>

View File

@ -8,28 +8,6 @@
<parentName>&lt;undefined&gt;</parentName>
<maskName>&lt;undefined&gt;</maskName>
<events>
<event eventtype="3" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string></string>
</argument>
</arguments>
</action>
</event>
<event eventtype="6" enumb="11">
<action>
<libid>1</libid>
@ -48,6 +26,8 @@
<argument>
<kind>1</kind>
<string>hover = false;
color = get_color3(own, false);
</string>
</argument>
</arguments>
@ -71,6 +51,59 @@
<argument>
<kind>1</kind>
<string>hover = true;
global.selected[dex.dexno] = dexno;
global.selected[dex.pokemon] = pokemon;
global.selected[dex.form] = form;
global.selected[dex.type1] = type1;
global.selected[dex.type2] = type2;
global.selected[dex.sprite] = -1;
global.selected[dex.own] = own;
color = get_color3(own, true);
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="6" enumb="8">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>/// CLICKEDY CLICK
if (++own &gt;= 3)
own = 0;
color = get_color3(own, true);
global.selected[dex.own] = own;
global.savedata[idno] = own;
// Auto-Saves
if (file_exists("save.ini"))
{
ini_open("save.ini");
ini_write_real("Pokemon", string(idno), own)
//ini_write_real("Progress","count",global.count)
show_debug_message("Saved "+pokemon+" as "+string(own)+".");
ini_close();
}
else
show_debug_message("ERROR: Save file somehow went missing.");
</string>
</argument>
</arguments>
@ -93,26 +126,23 @@
<arguments>
<argument>
<kind>1</kind>
<string>if (own)
if (hover)
draw_set_color(c_maroon)
else
draw_set_color(c_red)
else
if (hover)
draw_set_color(c_gray)
else
draw_set_color(c_white)
<string>// Scaling
image_xscale = global.icon_scale;
image_yscale = global.icon_scale;
draw_rectangle(x+1, y+1, x+global.box_len-1, y+global.box_len-1, false);
// Back color
draw_set_color(color);
draw_rectangle(x+1, y+1, x+global.box_scale-1, y+global.box_scale-1, false);
draw_set_color(c_white);
//draw_self();
draw_sprite_stretched(sprite_index, 0, x, y, global.box_len, global.box_len);
//draw_sprite_stretched(sprite_index, 0, x, y, global.box_len, global.box_len);
draw_self();
// Sprite
if (spr != -1)
draw_sprite_ext(spr, 0, x+global.box_len/2, y+global.box_len/2, global.icon_scale, global.icon_scale, image_angle, image_blend, image_alpha);
draw_sprite_ext(spr, 0, x+global.box_scale/2, y+global.box_scale/2, global.icon_scale, global.icon_scale, image_angle, image_blend, image_alpha);
//draw_sprite(spr, 0, x+global.box_len/2, y+global.box_len/2);
</string>

View File

@ -0,0 +1,16 @@
///get_color(value, hover?)
if (!argument1)
switch(argument0)
{
case 0: return c_white;
case 1: return c_red;
case 2: return c_blue;
}
else
switch(argument0)
{
case 0: return c_gray;
case 1: return c_maroon;
case 2: return c_navy;
}

View File

@ -0,0 +1,16 @@
///get_color(value, hover?)
if (!argument1)
switch(argument0)
{
case 0: return c_white;
case 1: return c_red;
case 2: return c_blue;
}
else
switch(argument0)
{
case 0: return c_gray;
case 1: return c_maroon;
case 2: return c_navy;
}

View File

@ -18,7 +18,7 @@ if (( window_get_width() != global.window_width ||
// If mult scale is allowed:
//global.icon_scale = (1 * global.box_len) / 40;
for(var i=2; global.box_len>i*40; i++){show_debug_message("LOOPITY")}
for(var i=2; global.box_len>i*40; i++){}
global.icon_scale = i-1;
/*global.icon_scale = 2;
@ -30,6 +30,9 @@ if (( window_get_width() != global.window_width ||
with obj_slot
{
image_xscale = global.icon_scale;
image_yscale = global.icon_scale;
x = global.box_len/2 + global.box_len * slot_x;
y = global.box_len * slot_y;
}

View File

@ -0,0 +1 @@
return string_replace(string_replace(string_format(argument0, 3, 0), ' ','0'), ' ','0')