Quantcast

Jump to content

» «
Photo

Scm - Direct Drawing

7 replies to this topic
_DK
  • _DK

    Beчнo пьяный.

  • Members
  • Joined: 12 Apr 2009
  • Ukraine

#1

Posted 27 July 2013 - 01:01 PM Edited by DK22Pac, 08 September 2013 - 03:51 PM.

Idea
This thing provides an ability to render into frame buffer with scm code. It works only with 1.0 US exe.
Using
Include next file: DirectRender to your code ({$I directrender}), then use scm-funtions to define which code must be executed at rendering process.
{$CLEO}
{$I directrender}
0000:
while true
    wait 0
    /* You can use any of these names:
    directRender, direct_render, directDrawing, direct_drawing, ExecuteCodeAtRendering, execute_code_at_rendering to call this function. */
    0AB1: call @DirectRender 2 from @RenderCodeStart to @RenderCodeEnd
end

:RenderCodeStart
// code
:RenderCodeEnd
Why?
Direct rendering is impossible while scripts are executed (processed).
Also
For future plans, I also did functions to execute code at game re-starting and at resetting game graphic device. They are @ExecuteCodeAtClosing (execute_code_at_closing) and @DeviceReset (ExecuteCodeAtResetting, execute_code_at_resetting, device_reset, ResetDevice, reset_device).
WIP
Currently it is in testing stage (I did it yesterday and tested just now).
Examples
27on.jpgwx70.jpg

Text and texture
Drawing a fist icon texture and a text under it.
{$CLEO}
{$I directrender}
0000:
while true
    wait 0
    0AB1: call @DirectRender 2 from @texture to @end_texture
    0AB1: call @DirectRender 2 from @text to @end_text
end

:texture
0@ = 0xFFFFFFFF
0AA6: call_method 0x728520 struct 0xBAB1FC num_params 9 pop 0 _color 0@v _yx4 10.0 100.0 _yx3 10.0 10.0 _yx2 100.0 100.0 _yx1 100.0 10.0
:end_texture

:text
0AA5: call 0x719430 num_params 1 pop 1 0xFFFFFFFF                          // SetColor
0AA5: call 0x719380 num_params 2 pop 2 _yx 0.9 0.6                         // SetScale
0AA5: call 0x719610 num_params 1 pop 1 _alignment 1                        // SetAlignment
0AA5: call 0x719490 num_params 1 pop 1 _style 1                            // SetStyle
0AA5: call 0x719590 num_params 1 pop 1 _size 1                             // SetOutLine
0AA5: call 0x71A700 num_params 3 pop 3 _text "Hello, world!" _yx 105.0 8.0 // PrintString
:end_text
Wireframe peds
Drawing a ped model 'over' already drawed models, but with "wireframe" mode enabled.
{$CLEO}
{$I directrender}
0000:
while true
    wait 0
    0AB1: call @DirectRender 2 from @wireframe_peds to @end_wireframe_peds
end

:wireframe_peds
{$I forallpeds}
// Setup rendering states
0AA5: call 0x7FC2D0 num_params 2 pop 2 2 8
0AA5: call 0x7FE420 num_params 2 pop 2 1 6
// Rendering ped clump
0A96: 0@ = actor ped struct
0@ += 0x18
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AA5: call 0x749B20 num_params 1 pop 1 0@
// Setup rendering states
0AA5: call 0x7FC2D0 num_params 2 pop 2 3 8
0AA5: call 0x7FE420 num_params 2 pop 2 0 6
{$I for_end}
:end_wireframe_peds
Download
LINK
Installation
Put .dll and .asi files to SA root folder, and 'DirectDrawing' file to CLEO folder (or SB folder).
  • MasterHK likes this

Deji
  • Deji

    Coding like a Rockstar!

  • Members
  • Joined: 24 Dec 2007

#2

Posted 27 July 2013 - 01:39 PM

Ahh you managed to do what I tried to do in Black Market before I gave up. I was going to re-attempt this last night but decided waiting until SCRambl was complete and working on other projects using it would be easier.

And an extra bravo for a non-direct-draw (even though you called it direct drawing tounge2.gif) way of wireframing peds. Something else I tried to do with DirectDraw but couldn't figure DirectDraw out blush.gif

fabio3
  • fabio3

    PHP, C/C++, CLEO/SCM programmer

  • Members
  • Joined: 21 Feb 2012

#3

Posted 27 July 2013 - 05:13 PM

Cool, good work! icon14.gif

MasterHK
  • MasterHK

    کیان حامی

  • Members
  • Joined: 20 Mar 2013
  • Iran

#4

Posted 28 July 2013 - 06:03 AM

Awesome! just like everytime. colgate.gif
I think it's better than put this function
CODE
0AB1: call @DirectRender 2 from @RenderCodeStart to @RenderCodeEnd

into NewOpcodes.cleo as a new opcode.

But my question is how can I find texture structs (for example 0xBAB1FC) in:
CODE
:texture
0@ = 0xFFFFFFFF
0AA6: call_method 0x728520 struct 0xBAB1FC num_params 9 pop 0 _color 0@v _yx4 10.0 100.0 _yx3 10.0 10.0 _yx2 100.0 100.0 _yx1 100.0 10.0
:end_texture


? dontgetit.gif

ThirteenAG
  • ThirteenAG

    Li'l G Loc

  • Members
  • Joined: 29 Dec 2008

#5

Posted 28 July 2013 - 10:09 AM

QUOTE (MasterHK @ Sunday, Jul 28 2013, 10:03)
But my question is how can I find texture structs (for example 0xBAB1FC) in:
CODE
:texture
0@ = 0xFFFFFFFF
0AA6: call_method 0x728520 struct 0xBAB1FC num_params 9 pop 0 _color 0@v _yx4 10.0 100.0 _yx3 10.0 10.0 _yx2 100.0 100.0 _yx1 100.0 10.0
:end_texture


? dontgetit.gif

They're listed in IDB:
CODE

0xBAA250     _radarIcons     HudTextures

00000000 HudTextures     struc; (sizeof=0x100)
  00000000 empty1          dd ?
  00000004 empty2          dd ?
  00000008 radar_centre    dd ?
  0000000C arrow           dd ?
  00000010 radar_north     dd ?
  00000014 radar_airYard   dd ?
  00000018 radar_ammugun   dd ?
  0000001C radar_barbers   dd ?
  00000020 radar_BIGSMOKE  dd ?
  00000024 radar_boatyard  dd ?
  00000028 radar_burgerShot dd ?
  0000002C radar_bulldozer dd ?
  00000030 radar_CATALINAPINK dd ?
  00000034 radar_CESARVIAPANDO dd ?
  00000038 radar_chicken   dd ?
  0000003C radar_CJ        dd ?
  00000040 radar_CRASH1    dd ?
  00000044 radar_diner     dd ?
  00000048 radar_emmetGun  dd ?
  0000004C radar_enemyAttack dd ?
  00000050 radar_fire      dd ?
  00000054 radar_girlfriend dd ?
  00000058 radar_hospitaL  dd ?
  0000005C radar_LocoSyndicate dd ?
  00000060 radar_MADDOG    dd ?
  00000064 radar_mafiaCasino dd ?
  00000068 radar_MCSTRAP   dd ?
  0000006C radar_modGarage dd ?
  00000070 radar_OGLOC     dd ?
  00000074 radar_pizza     dd ?
  00000078 radar_police    dd ?
  0000007C radar_propertyG dd ?
  00000080 radar_propertyR dd ?
  00000084 radar_race      dd ?
  00000088 radar_RYDER     dd ?
  0000008C radar_saveGame  dd ?
  00000090 radar_school    dd ?
  00000094 radar_qmark     dd ?
  00000098 radar_SWEET     dd ?
  0000009C radar_tattoo    dd ?
  000000A0 radar_THETRUTH  dd ?
  000000A4 radar_waypoint  dd ?
  000000A8 radar_TorenoRanch dd ?
  000000AC radar_triads    dd ?
  000000B0 radar_triadsCasino dd ?
  000000B4 radar_tshirt    dd ?
  000000B8 radar_WOOZIE    dd ?
  000000BC radar_ZERO      dd ?
  000000C0 radar_dateDisco dd ?
  000000C4 radar_dateDrink dd ?
  000000C8 radar_dateFood  dd ?
  000000CC radar_truck     dd ?
  000000D0 radar_cash      dd ?
  000000D4 radar_flag      dd ?
  000000D8 radar_gym       dd ?
  000000DC radar_impound   dd ?
  000000E0 radar_light     dd ?
  000000E4 radar_runway    dd ?
  000000E8 radar_gangB     dd ?
  000000EC radar_gangP     dd ?
  000000F0 radar_gangY     dd ?
  000000F4 radar_gangN     dd ?
  000000F8 radar_gangG     dd ?
  000000FC radar_spray     dd ?
00000100 HudTextures     ends


0xBAB1FC     _hudTextures2   HudTextures2

00000000 HudTextures2    struc; (sizeof=0x18)
  00000000 fist            dd ?
  00000004 siteM16         dd ?
  00000008 siterocket      dd ?
  0000000C radardisc       dd ?
  00000010 radarRingPlane  dd ?
  00000014 skipIcon        dd ?
00000018 HudTextures2    ends
  • MasterHK likes this

MasterHK
  • MasterHK

    کیان حامی

  • Members
  • Joined: 20 Mar 2013
  • Iran

#6

Posted 29 July 2013 - 12:32 AM Edited by MasterHK, 01 August 2013 - 03:05 PM.

Thank you ThirteenAG colgate.gif

MasterHK
  • MasterHK

    کیان حامی

  • Members
  • Joined: 20 Mar 2013
  • Iran

#7

Posted 17 January 2014 - 03:25 PM Edited by MasterHK, 17 January 2014 - 03:46 PM.

i think there is a problem in your mod, but just perhaps.

after i installed this mod on my game, any minimize (via Windows key or Alt+Tab) or even change resolution; makes my game crash.

could u help me please?

_____

 

tested on clean game and doesn't had problem.

But...

directFont...

? :-?


Concavax
  • Concavax

    Crackhead

  • Members
  • Joined: 26 Dec 2013
  • None

#8

Posted 28 February 2014 - 11:51 PM

This feauture crash with ImVehFt 





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users