Register | Login
Forum Index > Source Help > assignment detecting
Author Message
Pages: 1 2 3 4
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1111] - posted: 2012-05-15 21:04:38
I've updated the beta download

here is the test plugin i used:

Code:
program WIN32DLL 'PLUGIN';

#include 'zirplug/framework.zir';
#include 'ch.zir';

//////////////////////////////

const strLoaded = 'Plugin has loaded!';

//////////////////////////////

int32 bufSize;
char* strSource;

//////////////////////////////


//
// This function can be done much better than this.
//
procedure emitLine(char* line) {
  uses edi;
  
  if (strAppend(strSource, line, bufSize) == false) {
    push edi;

    add bufSize, 2048
    edi = malloc(bufSize);    
    eax = strLen(strSource);
    strlcpy(edi, strSource, eax);    
    freemem(strSource);
    strSource = edi;    
    //now append it, maybe should check line is not 2048 bytes long :-p
    strAppend(strSource, line, bufSize);    
    
    pop edi
  }
}

function InitPlugin(pointer pGetF) {
  Ziron_LoadAll(pGetF); //use framework utility function to load all

  bufSize = 2048;
  strSource = malloc(2048);
  
  return strLoaded;
}

function UnloadPlugin() {
  //free strSource here
  freemem(strSource);
}


function FileEntry(DWord handle; char* code) {
  uses edi;
  
  eax = strSource;
  char*[eax] = 0;
  
  //your usual code here
  char inte[32];
  
  char tmp[2048];
 
  edi = strGetLine(code, @tmp);
  while(edi <> 0) {    
    strAppend(@tmp, '\r\n', 2048);
    
    emitLine(@tmp);
    edi = strGetLine(edi, @tmp);
  }  
  Ziron_ShowMessage(strSource);  
  
  Ziron_SetFileBuffer(handle, strSource, strLen(strSource));
}

entry function DLLMain(DWord iDLL; DWord iReason; Pointer iResult) {
  if (iReason == DLL_PROCESS_ATTACH) {
    return true;
  }

  return false;
}

exports InitPlugin, UnloadPlugin, FileEntry;


works like a charm, have fun and g'luck with plugin smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1 2 3 4
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 6 user(s) online. 0 member(s) and 6 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd