macressler / bwapi

Automatically exported from code.google.com/p/bwapi
1 stars 0 forks source link

PROPOSAL -- Storm detours #78

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This is just a proposal to cut down on hooks and reading Starcraft memory,
using import detours (used by Shadowflare's tools, MPQDraft, etc).

in DLLMain:
1. nextFrameHook -- Detour SBltROP3.
2. onGameEnd -- Find a suitable detour. Maybe SNetLeaveGame?
3. onRemoveUnit -- Can't be avoided?
4. onSendText -- Detour SNetSendMessage and SNetSendServerChatCommand.
5. onSendSingle -- Not sure.
6. onSendLobby -- Same as onSendText (they work exactly the same way).
7. onDrawHigh -- Possibly find some other functions and detours for drawing.
8. onRefresh -- I don't even know what this hook does.
9. onIssueCommand -- Detour SNetReceiveTurns or SNetSendTurn.

in Offsets.h:
1. Player Resources -- Can't do much about it.
2. All DAT files -- Load them from the MPQ archives instead. Can make a
call to SFileOpenFile and SFileLoadFile.
3. Start positions, force names, and force flags -- Can detour
SFileOpenFile or SFileLoadFile to check for scenario.chk and read the
scenario file.
4. Players and alliance -- Not sure but I think we could pull this off
using map reads and assuming things.
5. Unit counts -- Can't do much about this.
6. Game type -- Could possibly detour SFileLoadFile and find out which GOT
file is loaded.
7. Map tiles, creep, units, etc -- Can probably find these buffers by
detours of SMem functions with a fixed size (variable for map sizes).
8. Map size -- Read from chk.
9. Latency -- Read from an SNet call.
10. Unit selection, game commands, etc -- Use SNetSendTurn.
11. In-game, in-replay, isMultiplayer -- Can be guessed by finding out
which files are being read or which functions are being called.
12. Quit mission -- We don't have a good implementation of it yet anyway.
13. SendText, SendPublic, SendLobby -- Use SNetSendMessage.
14. CurrentPlayer -- Can probably retrieve this using SNet* detours or calls.
15. CurrentPlayerSelectionGroup -- Not necessary.
16. GameEnd -- Detour SFileCloseFile and find which are being unloaded.
17. Drawing, PrintXY, etc -- Might be able to detour a drawing function,
retrieve the drawing buffer, and overlay our new graphics over it.
18. Remove Unit -- Kind hard to figure out a way around this one.
19. Upgrade/tech levels -- Can't avoid.
20. Mouse X/Y -- Use system function.
21. Screen X/Y -- Not sure.
22. Current Map FIle Name -- Detour SFileOpenArchive call.
23. Supplies -- Not sure.
24. Everything else -- Already covered.

If we somehow manage to get all this working, then we could use BWAPI on
any version of Starcraft(including future versions).
Though they are just thoughts and nothing more. Opinions?

Original issue reported on code.google.com by AHeinerm on 13 Sep 2009 at 4:21

GoogleCodeExporter commented 9 years ago

Original comment by lowerlo...@gmail.com on 7 Dec 2009 at 6:15

GoogleCodeExporter commented 9 years ago

Original comment by lowerlo...@gmail.com on 7 Dec 2009 at 6:17

GoogleCodeExporter commented 9 years ago

Original comment by AHeinerm on 31 Jan 2010 at 4:35