1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-17 06:45:11 -05:00

Added file writing, reading, etc.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@233 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Wizzup? 2009-11-17 09:30:09 +00:00
parent f52f2986c4
commit cc3b9d401f
4 changed files with 150 additions and 81 deletions

View File

@ -7,7 +7,7 @@
<TargetFileExt Value=""/> <TargetFileExt Value=""/>
<Title Value="Mufasa Stand Alone"/> <Title Value="Mufasa Stand Alone"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="3"/> <ActiveEditorIndexAtStart Value="10"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <ProjectVersion Value=""/>
@ -33,7 +33,7 @@
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item2> </Item2>
</RequiredPackages> </RequiredPackages>
<Units Count="246"> <Units Count="247">
<Unit0> <Unit0>
<Filename Value="project1.lpr"/> <Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
@ -162,8 +162,8 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="TestUnit"/> <UnitName Value="TestUnit"/>
<CursorPos X="45" Y="290"/> <CursorPos X="8" Y="36"/>
<TopLine Value="286"/> <TopLine Value="16"/>
<EditorIndex Value="7"/> <EditorIndex Value="7"/>
<UsageCount Value="202"/> <UsageCount Value="202"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@ -219,7 +219,7 @@
<Filename Value="../../Units/MMLCore/client.pas"/> <Filename Value="../../Units/MMLCore/client.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="Client"/> <UnitName Value="Client"/>
<CursorPos X="29" Y="50"/> <CursorPos X="23" Y="48"/>
<TopLine Value="31"/> <TopLine Value="31"/>
<EditorIndex Value="2"/> <EditorIndex Value="2"/>
<UsageCount Value="201"/> <UsageCount Value="201"/>
@ -246,8 +246,8 @@
<Filename Value="../../Units/MMLCore/files.pas"/> <Filename Value="../../Units/MMLCore/files.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="files"/> <UnitName Value="files"/>
<CursorPos X="60" Y="285"/> <CursorPos X="1" Y="46"/>
<TopLine Value="253"/> <TopLine Value="37"/>
<EditorIndex Value="11"/> <EditorIndex Value="11"/>
<UsageCount Value="202"/> <UsageCount Value="202"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@ -311,9 +311,11 @@
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="mmlpsthread"/> <UnitName Value="mmlpsthread"/>
<CursorPos X="31" Y="72"/> <CursorPos X="20" Y="249"/>
<TopLine Value="59"/> <TopLine Value="221"/>
<EditorIndex Value="8"/>
<UsageCount Value="202"/> <UsageCount Value="202"/>
<Loaded Value="True"/>
</Unit36> </Unit36>
<Unit37> <Unit37>
<Filename Value="../../Units/PascalScript/uPSComponent.pas"/> <Filename Value="../../Units/PascalScript/uPSComponent.pas"/>
@ -378,9 +380,11 @@
</Unit45> </Unit45>
<Unit46> <Unit46>
<Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
<CursorPos X="36" Y="99"/> <CursorPos X="32" Y="80"/>
<TopLine Value="90"/> <TopLine Value="65"/>
<EditorIndex Value="9"/>
<UsageCount Value="100"/> <UsageCount Value="100"/>
<Loaded Value="True"/>
</Unit46> </Unit46>
<Unit47> <Unit47>
<Filename Value="../../../FPC/FPCCheckout/rtl/win/tthread.inc"/> <Filename Value="../../../FPC/FPCCheckout/rtl/win/tthread.inc"/>
@ -398,7 +402,7 @@
<Filename Value="../../Units/MMLCore/bitmaps.pas"/> <Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="bitmaps"/> <UnitName Value="bitmaps"/>
<CursorPos X="44" Y="896"/> <CursorPos X="51" Y="864"/>
<TopLine Value="864"/> <TopLine Value="864"/>
<EditorIndex Value="3"/> <EditorIndex Value="3"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
@ -724,9 +728,7 @@
<UnitName Value="colourpicker"/> <UnitName Value="colourpicker"/>
<CursorPos X="26" Y="56"/> <CursorPos X="26" Y="56"/>
<TopLine Value="31"/> <TopLine Value="31"/>
<EditorIndex Value="8"/>
<UsageCount Value="201"/> <UsageCount Value="201"/>
<Loaded Value="True"/>
</Unit97> </Unit97>
<Unit98> <Unit98>
<Filename Value="../../../cogat/Units/CogatUnits/compdragger.pas"/> <Filename Value="../../../cogat/Units/CogatUnits/compdragger.pas"/>
@ -991,7 +993,7 @@
<UnitName Value="web"/> <UnitName Value="web"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="129"/> <UsageCount Value="130"/>
</Unit136> </Unit136>
<Unit137> <Unit137>
<Filename Value="../../../lazarus/lcl/lazhelphtml.pas"/> <Filename Value="../../../lazarus/lcl/lazhelphtml.pas"/>
@ -1191,7 +1193,7 @@
<CursorPos X="15" Y="195"/> <CursorPos X="15" Y="195"/>
<TopLine Value="180"/> <TopLine Value="180"/>
<EditorIndex Value="6"/> <EditorIndex Value="6"/>
<UsageCount Value="122"/> <UsageCount Value="123"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit161> </Unit161>
<Unit162> <Unit162>
@ -1506,9 +1508,7 @@
<UnitName Value="colourhistory"/> <UnitName Value="colourhistory"/>
<CursorPos X="65" Y="46"/> <CursorPos X="65" Y="46"/>
<TopLine Value="46"/> <TopLine Value="46"/>
<EditorIndex Value="9"/> <UsageCount Value="60"/>
<UsageCount Value="59"/>
<Loaded Value="True"/>
</Unit208> </Unit208>
<Unit209> <Unit209>
<Filename Value="../../../Documents/lazarus/lcl/comctrls.pp"/> <Filename Value="../../../Documents/lazarus/lcl/comctrls.pp"/>
@ -1758,128 +1758,138 @@
<UnitName Value="about"/> <UnitName Value="about"/>
<CursorPos X="61" Y="6"/> <CursorPos X="61" Y="6"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="10"/> <UsageCount Value="23"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
</Unit245> </Unit245>
<Unit246>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/file.inc"/>
<CursorPos X="21" Y="26"/>
<TopLine Value="17"/>
<EditorIndex Value="10"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit246>
</Units> </Units>
<JumpHistory Count="29" HistoryIndex="28"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="../../Units/MMLCore/files.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="74" Column="23" TopLine="46"/> <Caret Line="83" Column="78" TopLine="68"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="../../Units/MMLCore/files.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="80" Column="20" TopLine="65"/> <Caret Line="142" Column="35" TopLine="127"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="../../Units/MMLCore/files.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="106" Column="80" TopLine="91"/> <Caret Line="144" Column="45" TopLine="127"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="../../Units/MMLCore/client.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="46" Column="25" TopLine="21"/> <Caret Line="277" Column="20" TopLine="262"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="../../Units/MMLCore/window.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="59" Column="32" TopLine="41"/> <Caret Line="279" Column="19" TopLine="262"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="../../Units/MMLCore/window.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="60" Column="37" TopLine="41"/> <Caret Line="110" Column="39" TopLine="102"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="../../Units/MMLCore/window.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="83" Column="78" TopLine="68"/> <Caret Line="139" Column="33" TopLine="124"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="../../Units/MMLCore/window.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="142" Column="35" TopLine="127"/> <Caret Line="140" Column="66" TopLine="124"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="../../Units/MMLCore/window.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="144" Column="45" TopLine="127"/> <Caret Line="142" Column="63" TopLine="124"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="../../Units/MMLCore/window.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="277" Column="20" TopLine="262"/> <Caret Line="144" Column="62" TopLine="124"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="../../Units/MMLCore/window.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="279" Column="19" TopLine="262"/> <Caret Line="145" Column="30" TopLine="124"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="../../Units/MMLCore/window.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="110" Column="39" TopLine="102"/> <Caret Line="193" Column="19" TopLine="178"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="../../Units/MMLCore/window.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="139" Column="33" TopLine="124"/> <Caret Line="347" Column="23" TopLine="332"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="../../Units/MMLCore/window.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="140" Column="66" TopLine="124"/> <Caret Line="374" Column="26" TopLine="359"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="142" Column="63" TopLine="124"/>
</Position15>
<Position16>
<Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="144" Column="62" TopLine="124"/>
</Position16>
<Position17>
<Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="145" Column="30" TopLine="124"/>
</Position17>
<Position18>
<Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="193" Column="19" TopLine="178"/>
</Position18>
<Position19>
<Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="347" Column="23" TopLine="332"/>
</Position19>
<Position20>
<Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="374" Column="26" TopLine="359"/>
</Position20>
<Position21>
<Filename Value="../../Units/MMLCore/client.pas"/> <Filename Value="../../Units/MMLCore/client.pas"/>
<Caret Line="47" Column="24" TopLine="31"/> <Caret Line="47" Column="24" TopLine="31"/>
</Position21> </Position15>
<Position22> <Position16>
<Filename Value="../../Units/MMLCore/input.pas"/> <Filename Value="../../Units/MMLCore/input.pas"/>
<Caret Line="271" Column="54" TopLine="261"/> <Caret Line="271" Column="54" TopLine="261"/>
</Position22> </Position16>
<Position23> <Position17>
<Filename Value="../../Units/MMLCore/input.pas"/> <Filename Value="../../Units/MMLCore/input.pas"/>
<Caret Line="273" Column="7" TopLine="258"/> <Caret Line="273" Column="7" TopLine="258"/>
</Position23> </Position17>
<Position24> <Position18>
<Filename Value="../../Units/MMLCore/client.pas"/> <Filename Value="../../Units/MMLCore/client.pas"/>
<Caret Line="50" Column="29" TopLine="31"/> <Caret Line="50" Column="29" TopLine="31"/>
</Position24> </Position18>
<Position25> <Position19>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/> <Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="127" Column="10" TopLine="112"/> <Caret Line="127" Column="10" TopLine="112"/>
</Position25> </Position19>
<Position26> <Position20>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/> <Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="386" Column="10" TopLine="371"/> <Caret Line="386" Column="10" TopLine="371"/>
</Position26> </Position20>
<Position27> <Position21>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/> <Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="424" Column="10" TopLine="409"/> <Caret Line="424" Column="10" TopLine="409"/>
</Position27> </Position21>
<Position28> <Position22>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/> <Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="738" Column="10" TopLine="723"/> <Caret Line="738" Column="10" TopLine="723"/>
</Position28> </Position22>
<Position29> <Position23>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/> <Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="758" Column="10" TopLine="743"/> <Caret Line="758" Column="10" TopLine="743"/>
</Position23>
<Position24>
<Filename Value="testunit.pas"/>
<Caret Line="36" Column="8" TopLine="16"/>
</Position24>
<Position25>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="198" Column="21" TopLine="181"/>
</Position25>
<Position26>
<Filename Value="../../Units/MMLCore/client.pas"/>
<Caret Line="48" Column="23" TopLine="31"/>
</Position26>
<Position27>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="249" Column="20" TopLine="221"/>
</Position27>
<Position28>
<Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
<Caret Line="21" Column="51" TopLine="1"/>
</Position28>
<Position29>
<Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
<Caret Line="84" Column="95" TopLine="61"/>
</Position29> </Position29>
<Position30>
<Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
<Caret Line="77" Column="37" TopLine="62"/>
</Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@ -0,0 +1,47 @@
function ps_CreateFile(Path: string): Integer;
begin
Result := CurrThread.Client.MFiles.CreateFile(Path);
end;
function ps_OpenFile(Path: string; Shared: Boolean): Integer;
begin
Result := CurrThread.Client.MFiles.OpenFile(Path, Shared);
end;
function ps_RewriteFile(Path: string; Shared: Boolean): Integer;
begin
Result := CurrThread.Client.MFiles.RewriteFile(Path, Shared);
end;
procedure ps_CloseFile(FileNum: Integer);
begin
CurrThread.Client.MFiles.CloseFile(FileNum);
end;
function ps_EndOfFile(FileNum: Integer): Boolean;
begin
Result := CurrThread.Client.MFiles.EndOfFile(FileNum);
end;
function ps_FileSize(FileNum: Integer): LongInt;
begin
Result := CurrThread.Client.MFiles.FileSizeMuf(FileNum);
end;
function ps_ReadFileString(FileNum: Integer; out s: string; x: Integer): Boolean;
begin
Result := CurrThread.Client.MFiles.ReadFileString(FileNum, s, x);
end;
function ps_WriteFileString(FileNum: Integer; s: string): Boolean;
begin
Result := CurrThread.Client.MFiles.WriteFileString(FileNum, s);
end;
function ps_SetFileCharPointer(FileNum, cChars, Origin: Integer): Integer;
begin
Result := CurrThread.Client.MFiles.SetFileCharPointer(Filenum, cChars, Origin);
end;
function ps_FilePointerPos(FileNum: Integer): Integer;
begin
Result := CurrThread.Client.MFiles.FilePointerPos(FileNum);
end;

View File

@ -71,6 +71,17 @@ Sender.AddFunction(@SetTargetBitmap,'procedure SetTargetBitmap(Bitmap : integer)
Sender.AddFunction(@SetDesktopAsClient,'procedure SetDesktopAsClient'); Sender.AddFunction(@SetDesktopAsClient,'procedure SetDesktopAsClient');
Sender.AddFunction(@SetTargetArray, 'procedure SetTargetArray(P: Integer; Size: TPoint);'); Sender.AddFunction(@SetTargetArray, 'procedure SetTargetArray(P: Integer; Size: TPoint);');
{files}
Sender.AddFunction(@ps_CreateFile, 'function CreateFile(Path: string): Integer;');
Sender.AddFunction(@ps_OpenFile, 'function OpenFile(Path: string; Shared: Boolean): Integer;');
Sender.AddFunction(@ps_RewriteFile, 'function RewriteFile(Path: string; Shared: Boolean): Integer;');
Sender.AddFunction(@ps_CloseFile, 'procedure CloseFile(FileNum: Integer);');
Sender.AddFunction(@ps_EndOfFile, 'function EndOfFile(FileNum: Integer): Boolean;');
Sender.AddFunction(@ps_FileSize, 'function FileSize(FileNum: Integer): LongInt;');
Sender.AddFunction(@ps_ReadFileString, 'function ReadFileString(FileNum: Integer; out s: string; x: Integer): Boolean;');
Sender.AddFunction(@ps_WriteFileString, 'function WriteFileString(FileNum: Integer; s: string): Boolean;');
Sender.AddFunction(@ps_SetFileCharPointer, 'Function SetFileCharPointer(FileNum, cChars, Origin: Integer): Integer;');
Sender.AddFunction(@ps_FilePointerPos, 'function FilePointerPos(FileNum: Integer): Integer;');
{other} {other}
Sender.AddFunction(@SaveScreenshot,'procedure SaveScreenshot(FileName: string);'); Sender.AddFunction(@SaveScreenshot,'procedure SaveScreenshot(FileName: string);');

View File

@ -195,6 +195,7 @@ end;
{$I PSInc/Wrappers/colour.inc} {$I PSInc/Wrappers/colour.inc}
{$I PSInc/Wrappers/math.inc} {$I PSInc/Wrappers/math.inc}
{$I PSInc/Wrappers/mouse.inc} {$I PSInc/Wrappers/mouse.inc}
{$I PSInc/Wrappers/file.inc}
{$I PSInc/Wrappers/keyboard.inc} {$I PSInc/Wrappers/keyboard.inc}
{$I PSInc/Wrappers/dtm.inc} {$I PSInc/Wrappers/dtm.inc}