Old 10th September 2005, 18:10   #1
DrPizza
Junior Member
 
Join Date: May 2002
Posts: 7
DEP fix?

It seems really easy to add two lines to Compiler.c to stop MilkDrop crashing on any new processor with DEP enabled. DEP is a good thing. "Turn it off for winamp" is not an acceptable solution. Rewriting the entire expression compiler to get rid of its heap and use a VirtualAlloc/VirtualProtected heap is the best solution but it's far beyond what I have any interest in doing; however, a quick and dirty fix like this:
code:

static void *newBlock(int size)
{
llBlock *llb;
int alloc_size;
DWORD oldProtection;
if (blocks_head && (LLB_DSIZE - blocks_head->sizeused) >= size)
{
void *t=blocks_head->block+blocks_head->sizeused;
blocks_head->sizeused+=size;
return t;
}
alloc_size=sizeof(llBlock);
if ((int)size > LLB_DSIZE) alloc_size += size - LLB_DSIZE;
llb = (llBlock *)GlobalAlloc(GMEM_FIXED,alloc_size); // grab bigger block if absolutely necessary (heh)
VirtualProtect(llb, alloc_size, PAGE_EXECUTE_READWRITE, &oldProtection);
llb->sizeused=size;
llb->next = blocks_head;
blocks_head = llb;
return llb->block;
}


is adequate to allow the thing to not crash; VirtualProtecting memory from GlobalAlloc is naughty, but it's not as bad as not VirtualProtecting the memory at all and subsequently crashing. The realAddress function seems to be wrong to me, too; it should just return the address passed in (at least, with VC++ 7.1; its debug mode doesn't adjust the base address of the functions, which is what one would expect, given that they're naked).
DrPizza is offline   Reply With Quote
Old 11th September 2005, 07:16   #2
Phat
Major Dude
 
Phat's Avatar
 
Join Date: Nov 2003
Posts: 940
Really I've never seen milkdrop crash ever.

Btw, would you happen to know how to do this?

http://sourceforge.net/forum/forum.p...orum_id=466691

"The ability to write to the q1-q8 variables from custom waveforms would be a huge improvement. Namely, you could use a waveform to do better analysis of the sound data for improved bass, mid, treb response, or even to divide into more than 3 bands. The documentation says you can do this, but it doesn't work. As waveforms come last in the order of things, the variables would have to be on a one frame delay [i.e reading a q variable in per frame would return the value written by a waveform in the preceding frame]."

??
Phat is offline   Reply With Quote
Old 12th September 2005, 23:50   #3
DrPizza
Junior Member
 
Join Date: May 2002
Posts: 7
Quote:
Originally posted by Phat
Really I've never seen milkdrop crash ever.
Crashes are guaranteed on Pentium Ms/Pentium 4s/Xeons/Athlons/Opterons if DEP is enabled (this is because Milkdrop attempts to copy executable code to read/write memory and then execute it).

Quote:
Btw, would you happen to know how to do this?
No; I don't have the time or the inclination to figure out how it works; the only reason I'm suggesting this fix is that it was preventing me from trying out Milkdrop in the first place (having never used it before).
DrPizza is offline   Reply With Quote
Old 13th September 2005, 02:53   #4
Phat
Major Dude
 
Phat's Avatar
 
Join Date: Nov 2003
Posts: 940
oh, okay. =)
Phat is offline   Reply With Quote
Old 13th September 2005, 18:28   #5
redi jedi
Will code for food
 
Join Date: Mar 2005
Location: orlando
Posts: 521
few things i can sugust phat, try and find the place where milkdrop cleans up its variables at the end of every frame, and see what it does with q1-q8, it might be as easy as deleting a line like "q1=0", or just changing the 0 to q1, although i guess that would be kinda reduntent, prolly better to just delet it. might also check where md initilizes at the begining of every frame, and see if that q1=0 line is there.
failing that, the only place i can think of that such a line might be is after the waves are drawn, mabe MD has seprate internal vars. for q1-q8 after it gets passed to the waves(mabye wave_q1-wave_q8).... witch actualy makes more sence considering that you can pass q1 to a wave change it in wave_per_frame then pass it to wave_per_point and not effect the value of q1 that's getting passed to wave2..... see what i'm saying?
MD has to be reseting the value somewhere, just need to find out where( mabye search the code for q1=0;

and that is why i'm not an english major....

Blah!
redi jedi is offline   Reply With Quote
Old 14th September 2005, 08:00   #6
Rovastar
Moderator
 
Join Date: Jun 2001
Location: London, England
Posts: 3,632
Send a message via AIM to Rovastar
OK I'll look into the DEP problem when I have time. As I don't have a intel box it would be tricky though.

for the variable the easist would be to have global variables I would think. Save trying to work out what Ryan is doing with that part of the code. Maybe pick another 8 variable names for it.

tbh when I do anything it will be larger bug fixes first rather then new features

"Rules are for the guidance of wisemen and the obedience of fools"

Visuals - Morphyre www.Morphyre.com
Rovastar is offline   Reply With Quote
Old 14th September 2005, 15:34   #7
DrPizza
Junior Member
 
Join Date: May 2002
Posts: 7
Quote:
OK I'll look into the DEP problem when I have time. As I don't have a intel box it would be tricky though.
FWIW, the issue will also occur with newer AMD processors with hardware DEP enabled too.
DrPizza is offline   Reply With Quote
Old 16th September 2007, 05:19   #8
Mike9182
Junior Member
 
Join Date: Sep 2007
Posts: 4
This problem also occurs on an Intel E6700 (my processor). I am running 64-bit Vista.
Mike9182 is offline   Reply With Quote
Old 16th September 2007, 11:24   #9
DrO
 
Join Date: Sep 2003
Posts: 27,873
try the version from the 5.5 beta which should resolve the issue now

-daz
DrO is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Visualizations > MilkDrop > MilkDrop Troubleshooting Forum

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump