V-GatesLoad.asm
资源名称:VeMU.rar [点击查看]
上传用户:santakups8
上传日期:2021-03-23
资源大小:544k
文件大小:5k
源码类别:
模拟服务器
开发平台:
Asm
- ;EasyCodeName=Module1,1
- ;-----------------------------------------------------------------------------------
- ; VeMU
- ; Its a package that allows the user to set his own server of the game
- ; "MuOnline", this is not an emulator since i am not "emulating"
- ; what the actual games does, i am "creating" a method for set a Server
- ; of this Game.
- ;
- ; Copyright (C) 2010 Felipe Ya馿z
- ;
- ; This program is free software: you can redistribute it and/or modify
- ; it under the terms of the GNU General Public License as published by
- ; the Free Software Foundation, either version 3 of the License, or
- ; (at your option) any later version.
- ;
- ; This program is distributed in the hope that it will be useful,
- ; but WITHOUT ANY WARRANTY; without even the implied warranty of
- ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ; GNU General Public License for more details.
- ;
- ; You should have received a copy of the GNU General Public License
- ; along with this program. If not, see http://www.gnu.org/licenses/.
- ;-----------------------------------------------------------------------------------
- ;-----------------------------------------------------------------------------------
- ; -----------------
- ; Coded /
- ; By /
- ; -={FeN$x)=-
- ; / Felipe Y.
- ; /
- ; -----------------
- ; Programming Lang: ASM
- ; Country: Chile
- ; My respect for all those who lost their lifes
- ; In the earthquake of my country...
- ; Let god take their spirits home...
- ;-----------------------------------------------------------------------------------
- .Const
- .Data?
- .Data
- szGates DB ".DataGamePlayGate.txt", 0
- .Code
- V_Gate_Init Proc
- assume edx:ptr GATE_STRUCT
- lea edx, pObjGates
- xor ecx, ecx
- .Repeat
- mov [edx].GateIndex, 0FFh ;-1
- mov [edx].LvlRequired, 0
- add edx, SizeOf GATE_STRUCT
- add ecx, 1
- .Until (ecx == MAX_GATES)
- assume edx:NOTHING
- Ret
- V_Gate_Init EndP
- V_Gate_Load Proc
- local pThisObj:Dword
- local LoopCounter:Dword
- local FilePosition:Dword
- local pBufferSpace:Dword
- local BytesReaded:Dword
- local StructFile:WIN32_FILE_ATTRIBUTE_DATA
- .const
- TotalVariablesForGates equ 10
- .code
- ;------------------------------------------------
- ; Clean local variables that are needed
- ;------------------------------------------------
- And LoopCounter, 0
- call V_Gate_Init
- ;-------------------------------
- ;Load file into memory
- ;-------------------------------
- lea edx, StructFile
- GetFileLength addr szGates, edx
- mov eax, StructFile.nFileSizeLow
- fastalloc eax, 1 ;alloc space for file
- mov pBufferSpace, eax
- lea edx, StructFile
- lea ecx, BytesReaded
- ReadThisFile Addr szGates, pBufferSpace, ecx ;read of file and handles the close
- mov ecx, StructFile.nFileSizeLow
- add eax, ecx
- mov dword ptr [eax], 0 ;Append to 00 byte in the end of file for prevent bugs
- xor ecx, ecx
- .While (ecx != -1) ;Infinite loop
- pObj TotalGatesLoaded, SizeOf GATE_STRUCT, pObjGates
- mov pThisObj, eax
- xor ebx, ebx
- .Repeat
- push ebx
- invoke GetToken, pBufferSpace, ecx, NULL
- pop ebx
- .If (edx == 1)
- xor eax, eax
- .Break
- .Endif
- mov edx, pThisObj
- .if (LoopCounter == 9) ;Variable LvlRequirement
- mov word ptr [edx + ebx], Ax
- add ebx, 2
- .else
- mov [edx + ebx], Al ;Save all Gates variables
- add ebx, 1
- .endif
- Add LoopCounter, 1
- .Until (LoopCounter == TotalVariablesForGates)
- mov LoopCounter, 0
- add TotalGatesLoaded, 1
- .if (TotalGatesLoaded > MAX_GATES)
- RGB 255, 64, 64 ;Red Collor
- Mov Edx, Eax
- Invoke vprint, $CTA0("GateSystem:] ERROR YOU CANT BLOCK MORE THAN : [%d] GATES"), Edx, 1, MAX_GATES
- mov eax, 1
- .Break
- .endif
- mov FilePosition, ecx
- invoke GetString, pBufferSpace, ecx ;Search for string "End"
- push ecx
- invoke szCmp, $CTA0("end"), Addr StringToken
- pop ecx
- .if (eax != 0)
- mov eax, 1
- .Break
- .Endif
- mov ecx, FilePosition
- .Endw
- .If (eax == 0)
- RGB 255, 64, 64 ;Red Collor
- Mov Edx, Eax
- Invoke vprint, $CTA0("GateSystem:] UNKNOWN ERROR, LAST GATE LOADED : [%d]"), Edx, 1, TotalGatesLoaded
- .Else
- RGB 24, 116, 205 ;Light blue
- Mov Edx, Eax
- Invoke vprint, $CTA0("GateSystem:] Operation Successful total gates loaded : [%d]"), Edx, 1, TotalGatesLoaded
- .Endif
- FastDeAlloc pBufferSpace, NULL, 0 ;Free the heap when we dont use it anymore
- Ret
- V_Gate_Load EndP