#emit Discussion
#11

I just can't see what is wrong in the code below

Код:
stock _INI_LOG(INI:handle, msg[], {Float, _}:...)
{
	printf("ERR MSG %s",msg);

    static arg_count_bytes;
    static str[128],start_adr,end_adr;

    new File:LogFile = fopen(INI_LOG_FILE,io_append);

    #emit LOAD.S.pri  8
	#emit CONST.alt 8 //2 STATIC ARGUMENTS ; 2*4 = 8
	#emit SUB
	#emit STOR.pri arg_count_bytes

    if(arg_count_bytes)
    {
        #emit LCTRL	5
        #emit CONST.alt	msg
        #emit ADD
        #emit STOR.pri	start_adr

        #emit LOAD.alt	arg_count_bytes
        #emit ADD
        #emit STOR.pri	end_adr

        do
        {
            #emit LOAD.I
            #emit PUSH.pri
            #emit LOAD.pri end_adr
            #emit CONST.alt 4
			#emit SUB
			#emit STOR.pri end_adr
        }while(end_adr > start_adr);

        #emit PUSH.S	msg
        #emit PUSH.C 	128
        #emit PUSH.ADR	str

		#emit LOAD.pri arg_count_bytes
		#emit CONST.alt 12
		#emit ADD
		#emit STOR.pri arg_count_bytes
        #emit PUSH.pri

        #emit SYSREQ.C	format

        #emit LOAD.pri arg_count_bytes
		#emit CONST.alt 4
		#emit ADD
		#emit XCHG

        #emit LCTRL	4
        #emit ADD
        #emit SCTRL	4

        if(LogFile)
            fwrite(LogFile,str);
        else
        {
            print("Could not open Log File ("#INI_LOG_FILE")");
            print(str);
		}
	}
	else
	{
        if(LogFile)
        {
            fwrite(LogFile,str);
			fclose(LogFile);
		}
        else
        {
            print("Could not open Log File("#INI_LOG_FILE")");
            print(str);
		}
    }
}
Код:
[08:42:39] ERR MSG [INI]CreateINI:File already exists(%s)
[08:42:39] ERR MSG [INI]Warning:Creating another instance of the same file(%s)
[08:42:39] ERR MSG [INI]ReadString:Key(%s) not found in section ID %d 
[08:42:39] [debug] Run time error 6: "Invalid instruction"
[08:42:39] [debug]  Unknown opcode 0x24000000 at address 0x00000061
[08:42:39] [debug] AMX backtrace:
[08:42:39] [debug] #0 00000061 in public OnFilterScriptInit () at H:\eXtended INI Processor\Server\pawno\include\eINI.inc:254
[08:42:39]   Loaded 1 filterscripts.
It works few times and then suddenly fails
The line 254 is the printf at the very beginning of the function. So did I corrupt the AMX?

Did some random changes to my OnFilterScriptInit which has no relationship with my INI Include but the error seems to change

Код:
[08:50:43] -4081998 ERR MSG [INI]CreateINI:File already exists(%s)
[08:50:43] [debug] Server crashed while executing TestEINI.amx
[08:50:43] [debug] AMX backtrace:
[08:50:43] [debug] #0 native format () [00472b80] from samp-server.exe
[08:50:43] [debug] #1 000001e0 in _INI_LOG (INI:handle=-4081998, msg[]=@0x0009563c "[INI]CreateINI:File already ex...", ... <1 argument>) at H:\eXtended INI Processor\Server\pawno\include\eINI.inc:277
[08:50:43] [debug] #2 0000095c in INI:eINI_CreateINI (fname[]=@0x0009a924 "NewFile.ini") at H:\eXtended INI Processor\Server\pawno\include\eINI.inc:483
[08:50:43] [debug] #3 00011888 in public OnFilterScriptInit () at H:\eXtended INI Processor\Server\filterscripts\TestEINI.pwn:44
[08:50:43] [debug] Native backtrace:
[08:50:43] [debug] #0 00403334 in ?? () from samp-server.exe
[08:50:43] [debug] #1 625658ca in ?? () from plugins\crashdetect.DLL
[08:50:43] [debug] #2 6256774f in ?? () from plugins\crashdetect.DLL
[08:50:43] [debug] #3 62560834 in ?? () from plugins\crashdetect.DLL
[08:50:43] [debug] #4 6256591a in ?? () from plugins\crashdetect.DLL
[08:50:43] [debug] #5 0046a918 in ?? () from samp-server.exe
Код:
#emit ADD
        #emit STOR.pri	end_adr

        do <- LINE 277
        {
            #emit LOAD.I
            #emit PUSH.pri
Reply


Messages In This Thread
#emit Discussion - by Yashas - 20.06.2015, 18:47
Re: #emit Discussion - by ]Rafaellos[ - 20.06.2015, 19:08
Re: #emit Discussion - by Misiur - 20.06.2015, 21:18
Re: #emit Discussion - by Yashas - 21.06.2015, 04:38
Re: #emit Discussion - by Misiur - 21.06.2015, 07:50
Re: #emit Discussion - by Yashas - 21.06.2015, 08:48
Re: #emit Discussion - by PeterJane - 25.06.2015, 00:29
Re: #emit Discussion - by Yashas - 12.07.2015, 07:56
Re: #emit Discussion - by Vince - 12.07.2015, 10:46
Re: #emit Discussion - by Yashas - 12.07.2015, 10:54
Re: #emit Discussion - by Yashas - 31.08.2015, 15:46
Re : #emit Discussion - by Dutheil - 10.11.2015, 23:04
Re: #emit Discussion - by Yashas - 11.11.2015, 13:09
Re: #emit Discussion - by Dutheil - 18.07.2017, 14:26
Re: #emit Discussion - by Nero_3D - 18.07.2017, 23:47
Re: #emit Discussion - by Dutheil - 19.07.2017, 00:31
Re: #emit Discussion - by Nero_3D - 19.07.2017, 22:07
Re: #emit Discussion - by Dutheil - 29.12.2017, 14:45
Re: #emit Discussion - by Misiur - 29.12.2017, 15:24
Re: #emit Discussion - by Kaperstone - 29.12.2017, 15:49
Re: #emit Discussion - by Y_Less - 29.12.2017, 16:00
Re: #emit Discussion - by Dutheil - 29.12.2017, 19:56

Forum Jump:


Users browsing this thread: 1 Guest(s)