General Plugin Template
Open up nextFrame.cc and get to it!
v1.40 --
http://broodwarai.com/GPTP/main.htm
Post has been edited 4 time(s), last time on May 22 2009, 2:13 am by A_of-s_t.
ALL PRAISE YOUR SUPREME LORD CORBO
Awesome, does it come with a list of variables we can call and modify or the example is the only help we'll get?
Also, can one use ASM__ inside the function?
fuck you all
For the gcc compiler and .bat file, you need to use att asm:
__asm("...");
I have a tutorial somewhere about the differences between att and intel asm, I can upload it with the next version.
Check out some of the other examples given in the code itself for more help. I believe I included enough to allow people to only need to write in main.cpp. You can access buttons, units, and resource information.
EDIT:
I updated the package:
[attach=3541]
It now includes some helpful files and premade functions (see "List of Functions.txt").
Attachments:
Post has been edited 1 time(s), last time on May 18 2009, 3:33 am by A_of-s_t.
This might be a stupid question, but how do you use the new functions you code?
None.
Do you mean the hooks? Open up nextFrame.cc and put all code in that function located there. Compile and that's it.
That much I understand. I'm confused as to how I can use them once they're compiled.
None.
the function nectFrame() runs every time SC's screen is updated. All you do is rename qdp.dll to have a .qdp extension and use MPQDraft or Firegraft and import it.
Ah, that would be my problem. I was expecting it to be recognized by Firegraft to add buttons or such in there.
How do you manipulate the button sets? I've tried playing around with the example given in buttons.h, but it doesn't seem to work.
None.
Add this right before the nextFrame() function:
//-----------------------ACT_FUNC EXAMPLE-----------------------//
void __fastcall AfterBurnerAction(u32 actVar, u32 shiftClick){
UNIT* unit;
int * curUnit = (int*)0x005971F0; //005971F0 ? Selection Group (4 * 12)
int n = (*curUnit - 0x0059CC90) / 336;
unit = &unitTable[n];
unit->flingyAcceleration = unit->flingyAcceleration + 50;
unit->flingySpeed = unit->flingySpeed + 200;
unit->healthPoints = ((unit->healthPoints >> 8)/2) << 8;
if(unit->healthPoints >> 8 == 0) {
unit->mainOrderId = 0;
}
}
//Note: Will crash in multiplayer
//-----------------------REQ_FUNC EXAMPLE-----------------------//
BUTTON_STATE::Enum __fastcall AfterBurnerRequire(u32 reqVar, u32 playerId, UNIT* selected){
if(selected->healthPoints >> 8 <= 25){
return BUTTON_STATE::Disabled;
}
if(selected->healthPoints >> 8 > 25){
return BUTTON_STATE::Enabled;
}
return BUTTON_STATE::Disabled;
}
void newButton(){
buttonSet = &buttonSetTable[n]; //Button Set 'n'
button = buttonSet->firstButton;
button->iconID = 374;
button->actFunc = (ACT_FUNC*)&AfterBurnerAction;
button->reqFunc = (REQ_FUNC*)&AfterBurnerRequire;
}
Add this INSIDE the function:
newButton();
I get these errors when I copied your code as written:
h:\program files\microsoft visual studio 9.0\vc\bin\firegraft\nextFrame.cc(27) :
error C2065: 'buttonSetTable' : undeclared identifier
h:\program files\microsoft visual studio 9.0\vc\bin\firegraft\nextFrame.cc(27) :
error C2065: 'n' : undeclared identifier
I'm assuming 'n' is meant for me to change to the button set I want, but that doesn't explain the buttonSetTable error.
None.
Change 'n' and it get's rid the other error as well.
The other error is still there for me after changing it.
None.
Okay, I fixed it. I'm releasing a new version since I had to fix a few files:
http://broodwarai.com/GPTP/main.htmCheck out func_example.h to see how to do buttons
.
I tried compiling the example button function, which if I understand right, will create a new button not attached to a set that calls a function that does nothing, correct?
When I try running my Firegraft executable, which contains no modifications other than the new button patch, StarCraft crashes as soon as I enter a game. I'm using 1.15.1 as the readme says, but I have downgraded from 1.16.1, which might be the problem.
None.
Upload it and I'll check it out. It might be the fact that I transfered some of the addresses incorrectly.
I believe I figured out what the problem is. The nextFrame function runs every time SC updates the screen (I believe), even when not in game. Likewise, you can only change things concerning buttons while ingame. I messed up some addresses dealing with onGame start and such... so...
Let me update the template with the correct addresses.
<<UPDATED>>
New version is 1.40.a. Next up is text printing.
Post has been edited 2 time(s), last time on May 23 2009, 7:05 pm by A_of-s_t.
It runs fine now as far as I can tell, but I get this message when compiling the plugin:
H:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
None.
It's just a warning. The .dll should compile anyway with no side effects.
BTW, did you see the new example in func_example.cpp? I had forgotten a line in the previous example that was extremely important