+ Reply to Thread
Showing results 1 to 14 of 14

Thread: [Starcraft] Custom Clientside Color Text

  1. #1

    Evangelist
    nano351 is a jewel in the rough nano351's Avatar
    Join Date
    Dec 2007
    Location
    Pennsylvania
    Posts
    1,198
    Downloads
    6
    Uploads
    0

    [Starcraft] Custom Clientside Color Text

    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
    by patching at 0041FDB6 you can create your own custom color characters for high unused characters such as 7Fh. To setup a color you must first setup a color structure. It seems to me that it's just 8 byte array. It also seems that only a few bytes are used from that array:
    Code:
    00h,XXh,XXh,XXh,00h,00h,00h,XXh
    the last byte is usually for shadow and the second, third, and forth are for different parts of the text's coloring the second being the largest portion.
    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
    Another way of patching is you could find when the color presets are written and change a preset after it is written to. This method doesn't quite get as much variety availability.

    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.

  2. #2
    Banned

    Advocate
    hellinsect has a spectacular aura about
    Join Date
    Dec 2007
    Posts
    325
    Downloads
    0
    Uploads
    1

    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.

  3. #3

    Evangelist
    nano351 is a jewel in the rough nano351's Avatar
    Join Date
    Dec 2007
    Location
    Pennsylvania
    Posts
    1,198
    Downloads
    6
    Uploads
    0

    I've found the function that handles all input for starcraft. Think I should post that up too?

  4. #4
    Banned

    Advocate
    hellinsect has a spectacular aura about
    Join Date
    Dec 2007
    Posts
    325
    Downloads
    0
    Uploads
    1

    Quote Originally Posted by nano351 View Post
    I've found the function that handles all input for starcraft. Think I should post that up too?
    Yes that would be cool. That would make it easy to redirect clicks and stuff if the arguments are universal.

    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. #5
    Banned

    Advocate
    hellinsect has a spectacular aura about
    Join Date
    Dec 2007
    Posts
    325
    Downloads
    0
    Uploads
    1

    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
    If I am right, correct me if I am wrong, I can disable certain sections of the screen by excluding them from the PaintStuct. This would allow even a parallel thread to print at that location without blinking or anything like that. If you NOP out the paint calls starcraft does not print anything on the screen, but still functions. This would be useful for square buttons unless I can take the opportunity to rewrite the screen with text that covers up what was there before. Then all I would have to worry about is writing under things in starcraft.

    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

  6. #6

    Evangelist
    nano351 is a jewel in the rough nano351's Avatar
    Join Date
    Dec 2007
    Location
    Pennsylvania
    Posts
    1,198
    Downloads
    6
    Uploads
    0

    Very interesting. That might work out nicely.

  7. #7
    Master Yoshi Senior Member
    Game Hacking Staff
    Moderator

    Blessed
    Zynastor is a name known to all Zynastor is a name known to all Zynastor is a name known to all Zynastor is a name known to all Zynastor is a name known to all Zynastor's Avatar
    Join Date
    Jun 2005
    Location
    Australia
    Posts
    2,352
    Downloads
    18
    Uploads
    1

    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. #8
    Banned

    Advocate
    hellinsect has a spectacular aura about
    Join Date
    Dec 2007
    Posts
    325
    Downloads
    0
    Uploads
    1

    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.

  9. #9

    Evangelist
    nano351 is a jewel in the rough nano351's Avatar
    Join Date
    Dec 2007
    Location
    Pennsylvania
    Posts
    1,198
    Downloads
    6
    Uploads
    0

    By "command bar" you mean the area at the bottom where the buttons/minimap are shown. Perhaps you could created a demo dll/exe to demonstrate this theory?

  10. #10
    Banned

    Advocate
    hellinsect has a spectacular aura about
    Join Date
    Dec 2007
    Posts
    325
    Downloads
    0
    Uploads
    1

    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.

  11. #11

    Evangelist
    nano351 is a jewel in the rough nano351's Avatar
    Join Date
    Dec 2007
    Location
    Pennsylvania
    Posts
    1,198
    Downloads
    6
    Uploads
    0

    I knew there was visible screen beneath the command bar but I would assume that it would just draw the command bar second, overtop of what is already drawn.

  12. #12
    Banned

    Advocate
    hellinsect has a spectacular aura about
    Join Date
    Dec 2007
    Posts
    325
    Downloads
    0
    Uploads
    1

    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.

  13. #13
    =) Senior Member
    Game Hacking Staff

    Supreme Being
    K? Pŕo?ćtiόnŹ has a reputation beyond repute K? Pŕo?ćtiόnŹ has a reputation beyond repute K? Pŕo?ćtiόnŹ has a reputation beyond repute K? Pŕo?ćtiόnŹ has a reputation beyond repute K? Pŕo?ćtiόnŹ has a reputation beyond repute K? Pŕo?ćtiόnŹ has a reputation beyond repute K? Pŕo?ćtiόnŹ has a reputation beyond repute K? Pŕo?ćtiόnŹ has a reputation beyond repute K? Pŕo?ćtiόnŹ has a reputation beyond repute K? Pŕo?ćtiόnŹ has a reputation beyond repute K? Pŕo?ćtiόnŹ has a reputation beyond repute K? Pŕo?ćtiόnŹ's Avatar
    Join Date
    Oct 2004
    Location
    Delaware
    Posts
    10,928
    Blog Entries
    1
    Downloads
    20
    Uploads
    0

    I have never ****ed with DDraw. And I really have no interest to, although I'm sure you can do a lot more fancy advanced things then what we already got going.
    Kc: what waht
    DSG: in da butt
    DSG: lol
    DSG: :P
    Kc: what what!?
    Kc: IN THE BUTT
    Kc: I say what what?
    DSG: in the butt

  14. #14
    Banned

    Advocate
    hellinsect has a spectacular aura about
    Join Date
    Dec 2007
    Posts
    325
    Downloads
    0
    Uploads
    1

    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. [WarCraft III] Visual Custom Kick
    By sd333221 in forum User Downloads
    Replies: 133
    Last Post: 11-21-2007, 07:17 PM
  2. Custom Unit Spirtes for UMS
    By ineedhelp69 in forum Mods & Maps
    Replies: 2
    Last Post: 08-13-2007, 12:26 AM
  3. Is a custom patch possible?
    By el-camino-ss in forum Starcraft Hacking Related
    Replies: 8
    Last Post: 05-13-2007, 10:24 PM
  4. doing custom updaters
    By high6 in forum Starcraft Hacking Related
    Replies: 6
    Last Post: 09-26-2005, 11:27 PM

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts