

![]() |
![]() |
|
|||||||
![]() |
![]() |
| Code Snippets and Tutorials The place for open source releases, great information, and tutorials written by other members. |
![]() |
|
|
LinkBack | Thread Tools |
![]() |
![]() |
|
|
#1 (permalink) |
|
Banned
![]() Evangelist |
I have found a way that you can use any color from the currently loaded pallette in clientside text prints.
This function is used in all parts of the game except channels for printing and coloring characters(I had to upload a text file because posting it made this post too big): http://teh.projectbnet.net/Nano351/m...xtFunction.txt This Function selects what color to use: Code:
0041F600 /$ 3C 01 CMP AL,1 0041F602 |. 75 0B JNZ SHORT starcraf.0041F60F 0041F604 |. A1 D0E06C00 MOV EAX,DWORD PTR DS:[6CE0D0] 0041F609 |. A3 A8E06C00 MOV DWORD PTR DS:[6CE0A8],EAX 0041F60E |. C3 RETN 0041F60F |> 8B0D A8E06C00 MOV ECX,DWORD PTR DS:[6CE0A8] ; starcraf.006CDFE8 0041F615 |. 0FB6C0 MOVZX EAX,AL 0041F618 |. 83C0 FE ADD EAX,-2 ; Switch (cases 2..1F) 0041F61B |. 83F8 1D CMP EAX,1D 0041F61E |. 890D D0E06C00 MOV DWORD PTR DS:[6CE0D0],ECX 0041F624 |. 0F87 ED000000 JA starcraf.0041F717 0041F62A |. FF2485 18F7410>JMP DWORD PTR DS:[EAX*4+41F718] 0041F631 |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CDFE8 ; Case 2 of switch 0041F618 0041F63B |. C3 RETN 0041F63C |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CDFF0 ; Case 3 of switch 0041F618 0041F646 |. C3 RETN 0041F647 |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE000 ; Case 5 of switch 0041F618 0041F651 |. C3 RETN 0041F652 |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CDFF8 ; Case 4 of switch 0041F618 0041F65C |. C3 RETN 0041F65D |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE008 ; Case 6 of switch 0041F618 0041F667 |. C3 RETN 0041F668 |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE010 ; Case 7 of switch 0041F618 0041F672 |. C3 RETN 0041F673 |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE028 ; Case 8 of switch 0041F618 0041F67D |. C3 RETN 0041F67E |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE030 ; Case E of switch 0041F618 0041F688 |. C3 RETN 0041F689 |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE038 ; Case F of switch 0041F618 0041F693 |. C3 RETN 0041F694 |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE040 ; Case 10 of switch 0041F618 0041F69E |. C3 RETN 0041F69F |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE048 ; Case 11 of switch 0041F618 0041F6A9 |. C3 RETN 0041F6AA |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE050 ; Case 15 of switch 0041F618 0041F6B4 |. C3 RETN 0041F6B5 |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE058 ; Case 16 of switch 0041F618 0041F6BF |. C3 RETN 0041F6C0 |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE060 ; Case 17 of switch 0041F618 0041F6CA |. C3 RETN 0041F6CB |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE068 ; Case 18 of switch 0041F618 0041F6D5 |. C3 RETN 0041F6D6 |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE070 ; Case 19 of switch 0041F618 0041F6E0 |. C3 RETN 0041F6E1 |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE078 ; Case 1B of switch 0041F618 0041F6EB |. C3 RETN 0041F6EC |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE080 ; Case 1C of switch 0041F618 0041F6F6 |. C3 RETN 0041F6F7 |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE088 ; Case 1D of switch 0041F618 0041F701 |. C3 RETN 0041F702 |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE090 ; Case 1E of switch 0041F618 0041F70C |. C3 RETN 0041F70D |> C705 A8E06C00 >MOV DWORD PTR DS:[6CE0A8],starcraf.006CE0A0 ; Case 1F of switch 0041F618 0041F717 \> C3 RETN ; Default case of switch Code:
00h,XXh,XXh,XXh,00h,00h,00h,XXh An example would be this for pink in game lobby (which is in my latest version of host hack which still needs to be approved ):Code:
00h,77h,77h,00h,00h,00h,00h,00h With this new coloring method you are no longer limited to starcraft's preset colors for clientside text and the only limit now is the colors available in the current palette. |
|
|
|
![]() |
![]() |
|
Advertisement
|
|
![]() |
![]() |
|
|
#2 (permalink) |
![]() ![]() Deviant Join Date: Dec 2007
Posts: 115
![]() |
Nice work, It took me a whole day just to figure out how to print text on the screen.
There has to be an easer way to print text. Like an application that would stop starcraft from printing over the stuff it lays on the screen. Would be cool if there was. Then this application would bypass starcraft's clicking features though windows. Then you could have your own in game menus, buttons, pictures etc.
__________________
|
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#4 (permalink) | |
![]() ![]() Deviant Join Date: Dec 2007
Posts: 115
![]() |
Quote:
However, there should be a function that handles screen output through windows. It should be a WINapi call. If there are several, it still should be possible to hook them all with a search and find command. I am going to to look through some notes and study a screen refresh command. I think screen output is more complicated, but still possible to control. Starcraft uses a 640 x 480 size screen with 256 colors. Powerstip lets you see this and set Windows to this resolution. If you can make a picture look good in this setting then that picture could be printed on starcraft's screen looking the same way. P.S. The key would be to disable refresh commands to everything except the mouse at one location. Thats the only thing I can think of that would cause a problem - besides the menu and the little descriptions that pop up on the command bar and the gray effect that takes place when the game is paused and when you're not in the game. Then there is the problem of the layer under the thing you are printing, you can see units under the text. That can be retrieved and placed under the text thats being printed, or at least it needs to be updated first. The address to the SetRect WinAPI call is stored here 4FE360. When I Change that all SetRect calls will go straight to my dll. There might be other WinAPI screen update functions, I will know once direct it to a patch that balances the stack and does nothing.
__________________
Last edited by hellinsect : 07-29-2008 at 11:33 PM. |
|
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#5 (permalink) |
![]() ![]() Deviant Join Date: Dec 2007
Posts: 115
![]() |
Here is what I have found. I believe it is even better.
Code:
004D1AB4 MOV ESI,DWORD PTR SS:[EBP+8] ; Case F (WM_PAINT) of switch 004D19AA 004D1AB7 LEA EDX,DWORD PTR SS:[EBP-58] 004D1ABA PUSH EDX ; /pPaintstruct 004D1ABB PUSH ESI ; |hWnd 004D1ABC CALL DWORD PTR DS:[<&USER32.BeginPaint>] ; \BeginPaint 004D1AC2 LEA EAX,DWORD PTR SS:[EBP-58] 004D1AC5 PUSH EAX ; /pPaintstruct 004D1AC6 PUSH ESI ; |hWnd 004D1AC7 CALL DWORD PTR DS:[<&USER32.EndPaint>] ; \EndPaint 004D1ACD POP EDI 004D1ACE POP ESI 004D1ACF MOV DWORD PTR DS:[6D5DFC],1 004D1AD9 XOR EAX,EAX 004D1ADB POP EBX 004D1ADC MOV ESP,EBP 004D1ADE POP EBP 004D1ADF RETN 10 Reading this tutorial - Tutorial 4: Painting with Text - and then looking at the function above is very,very promising or misleading, time will tell.
__________________
Last edited by hellinsect : 07-30-2008 at 03:52 AM. |
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#7 (permalink) |
|
Senior Member
Game Hacking Staff ![]() ![]() High Priest |
Thats the SetTextColor() function, I used to hook that function to create my colored player names hack back in the day before it was added by blizzard. You can also call it before you print any game messages so there is need to insert the color code byte.
|
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#8 (permalink) |
![]() ![]() Deviant Join Date: Dec 2007
Posts: 115
![]() |
I found the 2 functions that print the screen, if I place breakpoints in them I can watch the screen be printed pixel by pixel while it writes over my ****.
The reason I said 2 functions is because one of them prints the command bar, the other prints everything on the "game play" screen. I am not sure if that makes sence to you, just wondering what what I should do. If I print my **** right after one of these calls, I garrenteed that it will not blink. If it does blink I know a simple way to fix that. This means I can print on top of everything in starcraft without it blinking. Pictures, See though text most GUI functions will work.
__________________
|
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#10 (permalink) |
![]() ![]() Deviant Join Date: Dec 2007
Posts: 115
![]() |
That's exactly right, command bar is everything below the game play screen, minimap buttons etc. It draws the command bar on the screen first, then it updates the screen. It uses a neat trick to not print on top of the command bar. There is visible screen under the command bar that the designers didn't want showing through. So it is never printed.
__________________
|
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#12 (permalink) |
![]() ![]() Deviant Join Date: Dec 2007
Posts: 115
![]() |
Starcraft uses DDraw to write rectangles on the screen. It accesses the data to write on the screen from Arrays. These arrays are called planes or layers. They are constantly updated with rectangle structures. I can use different direct draw functions to write to these arrays.
The question now is, has anyone ever attempted to use the DDraw functions to write bitmap objects to starcraft's graphic arrays before they are printed on the screen and what would be the problems in doing so, other then the complications? I am convinced it can be done, but the text would have to be converted into bitmaps.
__________________
|
|
|
|
![]() |
![]() |
![]() |
![]() |
|
|
#14 (permalink) |
![]() ![]() Deviant Join Date: Dec 2007
Posts: 115
![]() |
My theory uses 2 simple methods. All of the functions are available or easy to create.
A. Creating you're screen with GUI functions. 1.Define the approximate location of where you're writing to into a RECTstuct. 2.Select a very dark back ground like black or 1blue 0green 0red. 3.Delete RectStruct location on screen with background or use the GUI function with background. 4.Call GUI function which writes to the screen at the RectStruct. 5.Copy RectStruct on Screen to your bitmap array. 6 Add RectStruct to your personal array for scanning and deleting purposes. 7.Call for screen update at the RectStuct location. Starcraft has this function. B. Updating your screen with starcraft. 1. Scan RectStucts as they come into the screen updater function. Right before the mouse is written. 2. If any falls within one of your Rects, copy from your bitmap to the array that is about to be written on the screen. Exclude your background. You can literally flash black on the screen and no one will know. You don't have to use to whole screen, just use a small portion and only do that when you're updating your stuff.
__________________
Last edited by hellinsect : 07-31-2008 at 08:08 PM. |
|
|
|
![]() |
![]() |
| Sponsored links | |
|
Advertisement
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [WarCraft III] Visual Custom Kick | sd333221 | User Downloads | 133 | 11-21-2007 07:17 PM |
| Custom Unit Spirtes for UMS | ineedhelp69 | Mods & Maps | 2 | 08-13-2007 12:26 AM |
| Is a custom patch possible? | el-camino-ss | Starcraft Hacking Related | 8 | 05-13-2007 10:24 PM |
| doing custom updaters | high | |||