PAK-9
10th March 2005 10:53 UTC
APE Megabuf assignment
Does anyone know if there is a way to write directly to the megabuf in an APE? I want to assign thousands of megabuf items so compiling assignment code isnt really an option. If I could just get the address of the start of the megabuf or something... any ideas?
PAK-9
16th March 2005 18:33 UTC
Geez thanks for the input guys
hboy
16th March 2005 20:24 UTC
dunno. :D
Tuggummi
16th March 2005 20:56 UTC
Re: APE Megabuf assignment
Originally posted by PAK-9
If I could just get the address of the megabuf
Sure, it's:
Mr.Buf Mega
1337 SDK-Road
AmpLand
PAK-9
17th March 2005 14:29 UTC
omg thx!!1!one
Warrior of the Light
17th March 2005 14:32 UTC
Re: APE Megabuf assignment
Originally posted by PAK-9
Does anyone know if there is a way to write directly to the megabuf in an APE?
I guess there isn't anyone then..
S-uper_T-oast
17th March 2005 16:53 UTC
I don't see why it wouldn't be possible to do, but I don't know how.
MaTTFURY
17th March 2005 23:54 UTC
ask jaak or unconed or tomylobo :p
TomyLobo
18th March 2005 03:59 UTC
there might be one... it will require a bit of reverse engineering though.
i started with that but have given up at some point. here's what i have:
this little code snippet will give you the address of the megabuf function:
VM_CONTEXT vmc = g_extinfo->allocVM();
compileContext *ctx = (compileContext *)vmc;
VM_CODEHANDLE cod = g_extinfo->compileVMcode(vmc, "gmegabuf(0)");
codeHandleType *ch = (codeHandleType *)cod;
char *output = new char[1024];
memset(output,0,1024);
void *foo = *((void **)(((unsigned char *)ch->code)+25));
static double * (NSEEL_CGEN_CALL *__megabuf)(double ***,double *);
__asm {
mov eax,foo
mov __megabuf,eax
}
void (*blub)(void) = (void (*)(void))(ch->code);
//blub();
sprintf(output,"%X",__megabuf);
MessageBox(NULL, output, "debug output", 0);
delete[] output;
g_extinfo->freeCode(cod);
g_extinfo->freeVM(vmc);
you also need to put that struct somewhere:
#define YYSTYPE int
typedef struct
{
double **varTable_Values;
char **varTable_Names;
int varTable_numBlocks;
int errVar;
int colCount;
int result;
char last_error_string[256];
YYSTYPE yylval;
int yychar; /* the lookahead symbol */
int yynerrs; /* number of parse errors so far */
char yytext[256];
char lastVar[256];
char *llsave[16]; /* Look ahead buffer */
char llbuf[100]; /* work buffer */
char *llp1;// = &llbuf[0]; /* pointer to next avail. in token */
char *llp2;// = &llbuf[0]; /* pointer to end of lookahead */
char *llend;// = &llbuf[0]; /* pointer to end of token */
char *llebuf;// = &llbuf[sizeof llbuf];
int lleof;
int yyline;// = 0;
void *tmpblocks_head,*blocks_head;
int computTableTop; // make it abort on potential overflow =)
int l_stats[4]; // source bytes, static code bytes, call code bytes, data bytes
void *userfunc_data[64];
}
compileContext;
#define LLB_DSIZE (65536-64)
typedef struct _llBlock {
struct _llBlock *next;
int sizeused;
char block[LLB_DSIZE];
} llBlock;
typedef struct {
int workTablePtr_size;
llBlock *blocks;
void *code;
int code_stats[4];
} codeHandleType;
#define NSEEL_CGEN_CALL __fastcall
you can also find that in the nseel folder of the winamp SDK. better get it from there :)
PAK-9
18th March 2005 16:31 UTC
Well the address of the megabuf function is as good a starting point as any, thanks