게임 코드 자료실 2020. 4. 11. 13:02

SetKeyDelay,-1, 8

SetControlDelay, -1

SetMouseDelay, -1

SetWinDelay,-1

SendMode, InputThenPlay

SetBatchLines,-1

ListLines, Off

CoordMode, Pixel, Screen, RGB

CoordMode, Mouse, Screen

PID := DllCall("GetCurrentProcessId")

Process, Priority, %PID%, NormalGui ,Color, A4A4A4

Gui, Font, Bold cBlack, Arial

Gui, Font, Bold cBlack, Arial

Gui, Add, GroupBox, x12 y129 w240 h120 , 인식범위 조절

Gui, Font, Bold cBlack, Arial

Gui, Add, GroupBox, x12 y259 w240 h70 , 떨림보정

Gui, Add, GroupBox, x12 y9 w240 h120 , 해상도

Gui, Font, Bold, Arial

Gui, Font, s10 Bold cBlack, Arial

Gui, Font, s8 Bold cBlack, Arial

Gui, Add, Slider, x22 y279 w170 h40 center altsubmit range1-20 gloop vlpcou, %lpcou%

Gui, Font, s15 Bold c0x000000, Arial

Gui, Add, Text, x202 y289 w40 h20 vloopcou +0x200, %lpcou%

Gui, Font, s8 Bold cBlack, Arial

Gui, Font, Bold Underline cRed, Arial

Gui, Add, CheckBox, x272 y189 w70 h20 vta1, 팀구분

Gui, Add, CheckBox, x342 y189 w70 h20 vta2, 일반

Gui, Font, Bold Underline cblue, Arial

Gui, Add, CheckBox, x412 y189 w70 h20 vta3, A T

Gui, Font, Bold, Arial

Gui, Add, GroupBox, x262 y9 w230 h70 ,67

Gui, Add, Slider, x272 y29 w160 h40 center altsubmit range0-120 g슬라이더 v오차범위, %오차범위%

Gui, Font, s15 Bold c0x000000, Arial

Gui, Add, Text, x442 y29 w40 h40 v오차범위숫자 +0x200, %오차범위%

Gui, Font, Bold혻c0x000000, Arial

Gui, Add, GroupBox, x262 y79 w230 h80 , 배속

Gui, Add, Text, x642 y149 w190 h30 , Recommend value 15~20

Gui, Add, Slider, x272 y109 w160 h40 center altsubmit range1-30 gAMS vAimcount, %aimcount%

Gui, Font, s15 Bold c0x000000, Arial

Gui, Add, Text, x442 y109 w40 h40 vAimsc +0x200, %aimcount%

Gui, Font, s8 Bold, Tahoma

Gui, Add, Button, x262 y289 w50 h40 gSave1, Save1

Gui, Add, Button, x322 y289 w50 h40 gLoad1, Load1

Gui, Font, s10 Bold cblack, Arial

Gui, Add, Text, x22 y159 w40 h20 , 좌 우

Gui, Add, Text, x22 y209 w40 h20 , 상 하

Gui, Add, Text, x22 y39 w10 h20 , X

Gui, Add, Text, x22 y89 w10 h20 , Y

Gui, Add, Slider, x72 y149 w120 h40 center altsubmit range1-200 gscanX vFoX, %fox%

Gui, Add, Slider, x72 y199 w120 h40 center altsubmit range1-200 gscanY vFoY, %foy%

Gui, Add, Slider, x42 y29 w150 h40 center altsubmit range394-510 gaxisXX vaxisX, %axisX%

Gui, Add, Slider, x42 y79 w150 h40 center altsubmit range296-395 gaxisYY vaxisY, %axisY%

Gui, Font, s15 Bold c0x000000, Arial

Gui, Add, Text, x202 y39 w30 h20 vaxisXcou +0x200, %axisX%

Gui, Add, Text, x202 y89 w30 h20 vaxisYcou +0x200, %axisY%

Gui, Add, Text, x202 y159 w30 h20 vScanXcou +0x200, %FoX%

Gui, Add, Text, x202 y209 w30 h20 vScanYcou +0x200, %FoY%

Gui, Font, S8 CDefault, Verdana

Gui, Add, CheckBox, x272 y219 w80 h20 vLc gMouseMoves, LeftClick

Gui, Add, CheckBox, x362 y219 w90 h20 VRc gMouseMoves, RightClick

Gui, Font, S8 CRed Bold, Verdana

Gui, Add, Button, x382 y289 w50 h40 , Save2

Gui, Add, Button, x442 y289 w50 h40 , Load2

Gui, Font, S8 CGreen, Verdana

Gui, Add, Text, x282 y249 w190 h20 , 엘자와 쀼까

Gui, Font, S9 CGreen, Verdana

Gui, Font, S10 CGreen, Verdana

Gui, Font, S12 CGreen, Verdana

Gui, Font, S12 CGreen, Arial

Gui, Font, S12 CGreen Bold, Arial

Gui, Font, S12 CGreen Bold, Arial

Gui, Add, GroupBox, x262 y159 w230 h120 , 모 드

Gui, Show, x259 y242 h343 w508, YouTube

Gui, color, A4A4A4

gui,3:color, A4A4A4

suspend,off

ON = 0

ON2 = 0

Loop

{

ZeroX :=axisX

ZeroY :=axisY

ZeroX2 :=axisX

ZeroY2 :=axisY

XFoV := FoX

Yfov := FoY

ScanL := ZeroX-XFoV

ScanR :=ZeroX+Xfov

ScanT := ZeroY-Yfov

ScanB := ZeroY+Yfov

ScanL2 := ZeroX2-15

ScanR2 := ZeroX2+15

ScanT2 := ZeroY2-15

ScanB2 := ZeroY2+15

guicontrolget,foy

guicontrolget,fox

guicontrolget,axisX

guicontrolget,axisY

GetKeyState, Operate,%op%

GuiControlGet, Lc,,Lc

if Lc = 1

{

GetKeyState, Mouse_1, Lbutton, P

GuiControlGet, ta2,,ta2

if ta2 = 1

{

if Mouse_1 = D

{

PixelSearch, AimPixelX, AimPixelY, ScanL, ScanT, ScanR, ScanB, 0xFF00DD, %오차범위%, Fast RGB

if errorlevel = 0

{

GoSub GetAimOffset

GoSub GetAimMoves

GoSub MouseMoves

GoSub SleepF

loop

{

PixelSearch, AimPixelX, AimPixelY, ScanL2, ScanT2, ScanR2, ScanB2, 0x720072, %오차범위%, Fast RGB

if errorlevel = 0

{

GoSub GetAimOffset

GoSub GetAimMoves

GoSub MouseMoves

GoSub SleepF

}

else

{

break

}

}

}

}

}

}

GuiControlGet, Rc,,Rc

if Rc = 1

{

GetKeyState, Mouse_1, Rbutton, P

GuiControlGet, ta2,,ta2

if ta2 = 1

{

if Mouse_1 = D

{

PixelSearch, AimPixelX, AimPixelY, ScanL, ScanT, ScanR, ScanB, 0xFF00DD, %오차범위%, Fast RGB

if errorlevel = 0

{

GoSub GetAimOffset

GoSub GetAimMoves

GoSub MouseMoves

GoSub SleepF

loop

{

PixelSearch, AimPixelX, AimPixelY, ScanL2, ScanT2, ScanR2, ScanB2, 0x720072, %오차범위%, Fast RGB

if errorlevel = 0

{

GoSub GetAimOffset

GoSub GetAimMoves

GoSub MouseMoves

GoSub SleepF

}

else

{

break

}

}

}

}

}

}

GuiControlGet, ta3,,ta3

if ta3 = 1

{

if Mouse_1 = D

{

PixelSearch, AimPixelX, AimPixelY, ScanL, ScanT, ScanR, ScanB, 0x720072, %오차범위%, Fast RGB

if errorlevel = 0

{

GoSub GetAimOffset

GoSub GetAimMoves

GoSub MouseMoves

MouseClick, left

GoSub SleepF

}

}

}

GuiControlGet, ta1,,ta1

if ta1 = 1

{

if Mouse_1 = D

{

PixelSearch, AimPixelX, AimPixelY, ScanL, ScanT, ScanR, ScanB, 0xFF0000, 10, Fast RGB

if errorlevel = 0

{

PixelSearch, AimPixelX, AimPixelY, ScanL, ScanT, ScanR, ScanB, 0xFF00DD, %오차범위%, Fast RGB

if errorlevel = 0

{

GoSub GetAimOffset2

GoSub GetAimMoves

GoSub MouseMoves

loop

{

PixelSearch, AimPixelX, AimPixelY, ScanL2, ScanT2, ScanR2, ScanB2, 0x720072, %오차범위%, Fast RGB

if errorlevel = 0

{

GoSub GetAimOffset2

GoSub GetAimMoves

GoSub MouseMoves

GoSub SleepF

}

else

{

break

}

}

}

else errorlevel = 1

{

GoSub sleepF

}

}

}

}

}

Search:

{

PixelSearch, AimPixelX, AimPixelY, ScanL, ScanT, ScanR, ScanB, 0x720072, %오차범위%, Fast RGB

if errorlevel = 0

{

GoSub GetAimOffset

GoSub GetAimMoves

GoSub MouseMoves

GoSub SleepF

}

}

GetAimOffset:

AimX := AimPixelX - ZeroX

AimY := AimPixelY - ZeroY

If ( AimX > 1 ) {

DirX := 0.8

}

If ( AimX < 1 ) {

DirX := -0.8

}

If ( AimY > 1 ) {

DirY := 0.8

}

If ( AimY < 1 ) {

DirY := -0.8

}

AimOffsetX := AimX * DirX

AimOffsetY := AimY * DirY

Return

GetAimOffset2:

AimX := AimPixelX - ZeroX

AimY := AimPixelY - ZeroY

If ( AimX > 1 ) {

DirX := 0.98

}

If ( AimX < 1 ) {

DirX := -0.98

}

If ( AimY > 1 ) {

DirY := 0.98

}

If ( AimY < 1 ) {

DirY := -0.98

}

AimOffsetX := AimX * DirX

AimOffsetY := AimY * DirY

Return

GetAimMoves:

Fx =7

Zx=%Aimcount%

AimA:=Fx/Zx

RootX := Ceil(( AimOffsetX ** (AimA)))

RootY := Ceil(( AimOffsetY ** (AimA)))

MoveX := RootX * DirX

MoveY := RootY * DirY

return

MouseMoves:

If (Mouse_1 == "D" ){

DllCall("mouse_event", uint, 1, int, MoveX, int, MoveY, uint, 0, int, 0)

}

Return

SleepF:

SleepDuration = 6

TimePeriod = 1

DllCall("Winmm\timeBeginPeriod", uint, TimePeriod)

Iterations =%lpcou%

StartTime := A_TickCount

Loop, %Iterations% {

DllCall("Sleep", UInt, TimePeriod)

}

DllCall("Winmm\timeEndPeriod", UInt, TimePeriod)

Return

DebugTool:

ToolTip, %MoveX% | %MoveY% || %MX% %MY%

Return

f1::

ON = 1

splashimage 1:,B c1 X1 Y1 W240 H45 CW000000 CTFF5A5A Fs25 ws800, ON

sleep,1000

splashimage, 1: off

return

f2::

ON = 0

splashimage 1:,B c1 X1 Y1 W240 H45 CW000000 CTA748FF Fs25 ws1000, OFF

sleep,1000

splashimage, 1: off

return

3guiclose:

gui,3: Destroy

suspend,off

return

save1:

Gui,submit,nohide

IniWrite,%오차범위%,setting1.ini,Error range,Error range

IniWrite,%Aimcount%,setting1.ini,AimMoveSpeed,AimMoveSpeed

IniWrite,%FoX%,setting1.ini,ScanX,ScanX

IniWrite,%FoY%,setting1.ini,ScanY,ScanY

IniWrite,%Lpcou%,setting1.ini,Lpcount,Lpcount

IniWrite,%axisX%,setting1.ini,axisX,axisX

IniWrite,%axisY%,setting1.ini,axisY,axisY

Msgbox, 64 , 알림,Error Range"%오차범위%" , AMS"%Aimcount%" Scan Range XY"%FoX%,%FoY%", Iteration"%Lpcou%"

return

save2:

Gui,submit,nohide

IniWrite,%오차범위%, setting2.ini,Error range,Error range

IniWrite,%Aimcount%, setting2.ini,AimMoveSpeed,AimMoveSpeed

IniWrite,%FoX%, setting2.ini,ScanX,ScanX

IniWrite,%FoY%, setting2.ini,ScanY,ScanY

IniWrite,%Lpcou%, setting2.ini,Lpcount,Lpcount

IniWrite,%axisX%, setting2.ini,axisX,axisX

IniWrite,%axisY%, setting2.ini,axisY,axisY

Msgbox, 64 , 알림,Error Range"%오차범위%" , AMS"%Aimcount%" Scan Range XY"%FoX%,%FoY%", Iteration"%Lpcou%"

return

load1:

{

ifexist, %A_scriptDir%\setting1.ini

{

Gui,submit,nohide

IniRead,오차범위,setting1.ini,Error range,Error range

IniRead,Aimcount,setting1.ini,AimMoveSpeed,AimMoveSpeed

IniRead,FoX,setting1.ini,ScanX,ScanX

IniRead,foY,setting1.ini,FOVX,FOVX

IniRead,foy,setting1.ini,ScanY,ScanY

IniRead,Lpcou,setting1.ini,Lpcount,Lpcount

IniRead,axisX,setting1.ini,axisX,axisX

IniRead,axisY,setting1.ini,axisY,axisY

Guicontrol,,오차범위,%오차범위%

Guicontrol,,오차범위숫자,%오차범위%

Guicontrol,,Aimcount,%Aimcount%

guicontrol,,Aimsc,%Aimcount%

Guicontrol,,FoX,%FoX%

guicontrol,,ScanXcou,%FoX%

Guicontrol,,FoY,%FoY%

guicontrol,,ScanYcou,%FoY%

Guicontrol,,Lpcou,%Lpcou%

guicontrol,,LoopCou,%Lpcou%

Guicontrol,,axisX,%axisX%

Guicontrol,,axisY,%axisY%

Guicontrol,,axisXcou,%axisX%

Guicontrol,,axisYcou,%axisY%

msgbox, 64,알림,Open Setting1.ini

return

}

else

{

MsgBox, 16,Caution ini read fail,설정 값을 새로 저장해 주시기 바랍니다.

}

}

return

load2:

{

ifexist, %A_scriptDir%\setting2.ini

{

Gui,submit,nohide

IniRead,오차범위,setting2.ini,Error range,Error range

IniRead,Aimcount,setting2.ini,AimMoveSpeed,AimMoveSpeed

IniRead,FoX,setting2.ini,ScanX,ScanX

IniRead,foY,setting2.ini,FOVX,FOVX

IniRead,foy,setting2.ini,ScanY,ScanY

IniRead,Lpcou,setting2.ini,Lpcount,Lpcount

IniRead,axisX,setting2.ini,axisX,axisX

IniRead,axisY,setting2.ini,axisY,axisY

Guicontrol,,오차범위,%오차범위%

Guicontrol,,오차범위숫자,%오차범위%

Guicontrol,,Aimcount,%Aimcount%

guicontrol,,Aimsc,%Aimcount%

Guicontrol,,FoX,%FoX%

guicontrol,,ScanXcou,%FoX%

Guicontrol,,FoY,%FoY%

guicontrol,,ScanYcou,%FoY%

Guicontrol,,Lpcou,%Lpcou%

guicontrol,,LoopCou,%Lpcou%

Guicontrol,,axisX,%axisX%

Guicontrol,,axisY,%axisY%

Guicontrol,,axisXcou,%axisX%

Guicontrol,,axisYcou,%axisY%

msgbox, 64,알림,Open Setting2.ini

return

}

else

{

MsgBox, 16,Caution ini read fail,설정 값을 새로 저장해 주시기 바랍니다.

}

}

return

return

슬라이더:

gui, submit,nohide

guicontrol,,오차범위숫자,%오차범위%

return

AMS:

gui, submit,nohide

guicontrol,,Aimsc,%Aimcount%

return

ScanX:

gui, submit,nohide

guicontrol,,ScanXcou,%FoX%

return

ScanY:

gui, submit,nohide

guicontrol,,ScanYcou,%FoY%

return

Loop:

gui, submit,nohide

guicontrol,,LoopCou,%Lpcou%

return

axisXX:

gui, submit,nohide

guicontrol,,axisXcou,%axisX%

return

axisYY:

gui, submit,nohide

guicontrol,,axisYcou,%axisY%

return

return

GetOut:

GuiClose:

Gui, Hide

ExitApp

exitapp

posted by 핵커 커뮤니티
:
게임 코드 자료실 2020. 4. 11. 13:01

CoordMode, Mouse, Screen

CoordMode, Pixel, Screen

CoordMode, ToolTip, Screen

ListLines Off

SendMode InputThenPlay

SetBatchLines -1

SetControlDelay, -1

SetKeyDelay, -1, 0

SetMouseDelay, -1

SetWinDelay, -1

PID := DllCall("GetCurrentProcessId")

Process, Priority, %PID%, Normal

global X1, Y1, X2, Y2, 돌격소총, 빨간색, 저격소총, 배경색, 전경색

global FPGCBufferDC = 0

global FPGCReady = 0

global FPGCWait = 1

Gui, Color, FFFFFF

Gui, Font,, 맑은 고딕

Gui, Add, Text,, 해상도

Gui, Add, DropDownList, AltSubmit g설정 v해상도 w200, 1024 × 768||1280 × 1024

Gui, Show,, Bomchattack

Gui, 2: +LastFound +AlwaysOnTop -Caption +ToolWindow

Gui, 2: Color, 000000

Gui, 2: Font, cffffff s12 bold, 굴림

Gui, 2: Margin, 0, 0

Gui, 2: Add, Text, v상태표시줄 w200

gosub, 설정열기

return

설정:

Gui, Submit, NoHide

if (해상도 = 1) {

X1 = 481

Y1 = 448

X2 = 513

Y2 = 385

상태표시줄Y := 768 - 66

Gui, 2: Show, x211 y%상태표시줄Y% NA, Secondary Bomchattack OSD

} else if (해상도 = 2) {

X1 = 609

Y1 = 596

X2 = 640

Y2 = 513

상태표시줄Y := 1024 - 66

Gui, 2: Show, x211 y%상태표시줄Y% NA, Secondary Bomchattack OSD

}

return

설정저장:

Gui, Submit, NoHide

IniWrite, %해상도%, bomchattack.ini, Bomchattack 설정, 해상도

return

설정열기:

if (FileExist("bomchattack.ini")) {

IniRead, 해상도, bomchattack.ini, Bomchattack 설정, 해상도, 1

GuiControl, Choose, 해상도, %해상도%

gosub, 설정

} else {

GuiControl, Choose, 해상도, 1

gosub, 설정

}

return

End::

Suspend, Off

Gosub, GuiClose

return

GuiClose:

gosub, 설정저장

ExitApp

return

돌격소총사격실행:

SetTimer, 돌격소총사격실행, Off

while (돌격소총 = 1) {

updateFPGC()

빨간색 := FPGC(X1, Y1)

if (빨간색 = 0x0000ff) {

DllCall("mouse_event", "UInt", 0x02)

DllCall("Sleep", UInt, 768)

DllCall("mouse_event", "UInt", 0x04)

DllCall("Sleep", UInt, 256)

}

}

while (돌격소총 = 0) {

updateFPGC()

빨간색 := FPGC(X1, Y1)

if (빨간색 = 0x0000FF) {

DllCall("mouse_event", "UInt", 0x02)

DllCall("Sleep", UInt, 16)

DllCall("mouse_event", "UInt", 0x04)

DllCall("Sleep", UInt, 16)

}

}

return

저격소총사격실행:

SetTimer, 저격소총사격실행, Off

updateFPGC()

전경색 := FPGC(X2, Y2)

while (저격소총 = 1) {

updateFPGC()

배경색 := FPGC(X2, Y2)

if (전경색 <> 배경색) {

저격소총 = 0

DllCall("mouse_event", "UInt", 0x02)

DllCall("Sleep", UInt, 16)

DllCall("mouse_event", "UInt", 0x04)

DllCall("Sleep", UInt, 1)

GuiControl, 2: , 상태표시줄, 저격소총 사격

break

}

}

return

FPGC(x, y) {

global FPGCBufferDC, FPGCReady, FPGCWait

global FPGCScreenLeft, FPGCScreenTop

; check if there is a valid data buffer

if (!FPGCReady) {

if (FPGCWait) {

Start := A_TickCount

While !FPGCReady {

Sleep, 10

if (A_TickCount - Start > 5000)

return -3 ; time out if data is not ready after 5 seconds

}

}

else

return -2 ; return an invalid color if waiting is disabled

}

return DllCall("GetPixel", "Uint", FPGCBufferDC, "int", x - FPGCScreenLeft, "int", y - FPGCScreenTop)

}

updateFPGC() {

global FPGCReady, FPGCBufferDC

static oldObject = 0, hBuffer = 0

static screenWOld = 0, screenHOld = 0

; get screen dimensions

global FPGCScreenLeft, FPGCScreenTop

SysGet, FPGCScreenLeft, 76

SysGet, FPGCScreenTop, 77

SysGet, screenW, 78

SysGet, screenH, 79

FPGCReady = 0

; determine whether the old buffer can be reused

bufferInvalid := screenW <> screenWOld OR screenH <> screenHOld OR FPGCBufferDC = 0 OR hBuffer = 0

screenWOld := screenW

screenHOld := screenH

if (bufferInvalid) {

; cleanly discard the old buffer

DllCall("SelectObject", "Uint", FPGCBufferDC, "Uint", oldObject)

DllCall("DeleteDC", "Uint", FPGCBufferDC)

DllCall("DeleteObject", "Uint", hBuffer)

; create a new empty buffer

FPGCBufferDC := DllCall("CreateCompatibleDC", "Uint", 0)

hBuffer := CreateDIBSection(FPGCBufferDC, screenW, screenH)

oldObject := DllCall("SelectObject", "Uint", FPGCBufferDC, "Uint", hBuffer)

}

screenDC := DllCall("GetDC", "Uint", 0)

; retrieve the whole screen into the newly created buffer

DllCall("BitBlt", "Uint", FPGCBufferDC, "int", 0, "int", 0, "int", screenW, "int", screenH, "Uint", screenDC, "int", FPGCScreenLeft, "int", FPGCScreenTop, "Uint", 0x40000000 | 0x00CC0020)

; important: release the DC of the screen

DllCall("ReleaseDC", "Uint", 0, "Uint", screenDC)

FPGCReady = 1

}

posted by 핵커 커뮤니티
:
게임 코드 자료실 2020. 4. 11. 12:59

guif:

#NoEnv

#SingleInstance force

SkinForm(Apply, A_ScriptDir . "\USkin.dll", A_ScriptDir . "\Milikymac.msstyles")

Gui, Add, Text, x12 y40 w200 h30 , 오토에임 시작[F2]

Gui, Add, Text, x12 y60 w200 h30 , 프로그램 재시작[F3]

Gui, Add, Text, x12 y80 w200 h30 , 일시정지/해제[ALT]

 

Gui, Add, CheckBox, x292 y25 w150 h40 vaimtype Checked, 좌클릭 오토에임

Gui, Add, CheckBox, x292 y55 w150 h40 vaimtype1, 우클릭 오토에임

Gui, Add, Text, x230 y115 w80 h30 , 에임 속도

Gui, Add, Edit, x300 y110 w30 h20 vrx, 20

Gui, Add, Text, x230 y150 w80 h40 , 영점 조정

Gui, Add, Text, x230 y175 w80 h40 , x축 :

Gui, Add, Edit, x260 y170 w30 h20 vxa, 40

Gui, Add, Text, x300 y175 w80 h40 , y축 :

Gui, Add, Edit, x330 y170 w30 h20 vxy, 57

Gui, Add, Text, x230 y205 w80 h40 , 인식 범위

Gui, Add, Text, x230 y230 w80 h40 , x축 :

Gui, Add, Slider, x260 y225 w130 h25 vxrange Invert Tickinterval1 range1-4, 4

Gui, Add, Text, x230 y260 w80 h40 , y축 :

Gui, Add, Slider, x260 y255 w130 h25 vyrange Invert Tickinterval1 range1-4, 4

 

 

 

Gui, Show

Loop {

Gui, Submit, NoHide

Sleep -1

}

Return

 

#If

return

 

 

mouseXY(x,y)

{

DllCall("mouse_event",int,1,int,x,int,y,uint,0,uint,0)

}

#If

return

 

GuiClose:

ExitApp

return

SkinForm(Param1 = "Apply", DLL = "", SkinName = ""){

if(Param1 = Apply){

DllCall("LoadLibrary", str, DLL)

DllCall(DLL . "\USkinInit", Int,0, Int,0, AStr, SkinName)

}else if(Param1 = 0){

DllCall(DLL . "\USkinExit")

}

}

Change1:

MsgBox, Applied

Gui,Submit, Nohide

return

 

 

F2::

#Persistent

#KeyHistory, 0

#NoEnv

#HotKeyInterval 1

#MaxHotkeysPerInterval 127

#InstallKeybdHook

#UseHook

#SingleInstance, Force

SetKeyDelay,-1, 8

SetControlDelay, -1

SetMouseDelay, 0

SetWinDelay,-1

SendMode, InputThenPlay

SetBatchLines,-1

ListLines, Off

CoordMode, Mouse, Client

PID := DllCall("GetCurrentProcessId")

Process, Priority, %PID%, Normal

ZeroX := 800

ZeroY := 440

CFovX := 760

CFovY := 400

 

ScanL := ZeroX - CFovX

ScanR := ZeroX + CFovX

ScanT := ZeroY - CFovY

ScanB := ZeroY + CFovY

 

GuiControlget, rX

GuiControlget, xA

GuiControlget, yA

GuiControlget, xrange

GuiControlget, yrange

 

 

 

Loop,

 

{

if (aimtype=1)

{

GetKeyState, Mouse2, LButton, P

GoSub MouseMoves2

}

 

Gui,Submit, Nohide

if (aimtype1=1)

{

GetKeyState, Mouse2, RButton, P

GoSub MouseMoves2

}

 

imageSearch, AimPixelX, AimPixelY, 0 + (A_Screenwidth*(xrange/10)), 0 + (A_Screenheight*(yrange/10)), A_Screenwidth - (A_Screenwidth*(xrange/10)), A_Screenheight - (A_Screenheight*(yrange/10)), *4 hhp.bmp

GoSub GetAimOffset

GoSub GetAimMoves

 

}

 

MouseMoves:

If ( Mouse2 == "D" ) {

DllCall("mouse_event", uint, 1, int, MoveX, int, MoveY, uint, 0, int, 0)

}

Return

 

MouseMoves1:

If ( Mouse2 == "U" ) {

DllCall("mouse_event", uint, 1, int, MoveX, int, MoveY, uint, 0, int, 0)

}

Return

 

MouseMoves2:

If ( Mouse2 == "D" ) {

DllCall("mouse_event", uint, 1, int, MoveX, int, MoveY, uint, 0, int, 0)

}

GetAimOffset:

Gui,Submit, Nohide

AimX := AimPixelX - ZeroX +xA

AimY := AimPixelY - ZeroY +xY

If ( AimX+5 > 0) {

DirX := rx / 10

}

If ( AimX+5 < 0) {

DirX := (-rx) / 10

}

If ( AimY+2 > 0 ) {

DirY := rX /10 *0.5

}

If ( AimY+2 < 0 ) {

DirY := (-rx) /10 *0.5

}

AimOffsetX := AimX * DirX

AimOffsetY := AimY * DirY

Return

GetAimMoves:

RootX := Ceil(( AimOffsetX ** ( 1/2 )))

RootY := Ceil(( AimOffsetY ** ( 1/2 )))

MoveX := RootX * DirX

MoveY := RootY * DirY

Return

SleepF:

SleepDuration = 1

TimePeriod = 1

DllCall("Winmm\timeBeginPeriod", uint, TimePeriod)

Iterations = 1

StartTime := A_TickCount

Loop, %Iterations% {

DllCall("Sleep", UInt, TimePeriod)

}

DllCall("Winmm\timeEndPeriod", UInt, TimePeriod)

Return

DebugTool:

MouseGetPos, MX, MY

ToolTip, %AimOffsetX% | %AimOffsetY%

ToolTip, %AimX% | %AimY%

ToolTip, %IntAimX% | %IntAimY%

ToolTip, %RootX% | %RootY%

ToolTip, %MoveX% | %MoveY% || %MX% %MY%

Return

 

DebugTool1:

MouseGetPos, MX, MY

ToolTip, %AimOffsetX% | %AimOffsetY%

ToolTip, %AimX% | %AimY%

ToolTip, %IntAimX% | %IntAimY%

ToolTip, %RootX% | %RootY%

ToolTip, %MoveX% | %MoveY% || %MX% %MY%

Return

ALT::

pause

SoundBEEP

return

F3::

Reload

Return

posted by 핵커 커뮤니티
:
게임 코드 자료실 2020. 4. 11. 12:44

ㅇㅌㅇㅎ

8B 80 14 37 00 00 8B E5 5D C3

바이트  벨류 On:0

ㅁㅂㄷ

00 00 C0 3F 89 08 E8 F3 03 00

4바이트 벨류 On:0 Off:1069547520

ㅇㅇㄱㅈ

D9 46 2C D8 15

바이트  벨류 On:216 Off:217

12 jump

3C 00 02 00 00 00 02

바이트  벨류 On:89 Off:60

ㄴㄴㅅ

74 7C FF D5 99 B9 F0 FF 00 00

바이트  벨류 On:117 Off:116

ㅊㅇㅈㅅ

13 84 C0 75  위에서 9~11 번째꺼

4바이트  벨류 On:1958773779 Off:1975550995

ㅈㄷㅊㅅ

85 B5 00 00 00 6A 01

4바이트 벨류 On:46468 Off:46469

ㄱㅌ

74 1E D9 45

바이트  벨류 On:117 Off:116

ㅇㅇㅇㅍㄹㅇ ㅇㅎ

03 6A 08 8B 40 04 50 8B 08 FF

바이트  벨류 On:2 Off:3

ㄱㄹㅅ ㅇㅎ

01 6A 07 8B 40 04 50 8B 08 FF 91

바이트  벨류 On:0 Off:1

ㅂㄹㅇㅍ ㅇㅎ

84 85 01 00 00 D9 47 04 D8 99

바이트  벨류 On:133 Off:132

ㅈㅍ (1)

D8 C3 90 8B 44 24 04

바이트  벨류 On:217 Off:216

ㅈㅍ (2)

DF E0 F6 C4 41 0F 85 C9

바이트  벨류 On:222 Off:223

ㅈㅇㅈㄹ ㄹㅅㅍ

74 7A 8A 44 24 28 84 C0

4바이트 벨류 On:1149926005 Off:1149926004

ㄴㄷㄹㅇ

5C 85 C0 74 3D 83 FD FF 74 38

4바이트 벨류 On:1975551324 Off:1958774108

ㄴㅈㅈ

75 0A 8A 88 61 0C 00 00 84 C9 74 3C

바이트  벨류 On:116 Off:117

ㅈㅍㅁㅊ ㅈㄱ

84 C0 00 00 00 8B 0D ?? ?? ?? 20 83 B9

바이트  벨류 On:133 Off:132

ㅊㅁㄱ ㅈㄱ

75 30 D9 44 24 20 D8 1D 0C

4바이트 벨류 On:1155084404 Off:1155084405

ㅇㅍㅌ ㅈㄱㄱ

84 A3 00 00 00 EB 06 8B 15 / 68

바이트  벨류 On:133 Off:132

ㅁㅊ ㅈㄱ

24 10 33 C0 8A 47 06 33 C9 8A

바이트  벨류 On:23 Off:24

ㅋㅂㅁㅎ

DF E0 F6 C4 41 0F 85 C7 00 00 00 C7 86 B8 03 00

바이트  벨류 On:222 Off:223

ㄱㅈㄴㄴ

74 66 8B 55 08 8B 45 14 D9 42 04 D8 58 04 DF E0

바이트  벨류 On:117 Off:116

ㅈㅇㅅㅈ

C9 3B D0 5E 0F 94 ?? 8B ?? C3 ?? ?? ?? ?? ?? 56

바이트  벨류 On:202 Off:201

ㅅㅎ

44 00 FE FF 46

바이트  벨류 On:67 Off:68

[ㅎㄷㅁㅂ]cshell.dll+31C974

00 00 8C 42 00 80 D3 43 00 80 CB 43 00 00 92 42

4 바이트 기본 벨류 : 1116471296

4 바이트 바뀔 벨류  : 1232348160

[ㅇㅂㅇㄱ (1)]cshell.dll+18665E

D9 46 2C E8 ?? ?? ?? 00 8B F8 ?? ?? 8B DF 57 F7

4 바이트 기본 벨류 : 3895215833

4 바이트 바뀔 벨류  : 3895215832

[ㅇㅂㅇㄱ 2)]cshell.dll+18666D

F7 DB 53 89 7C 24 2C E8 ?? ?? 01 00 89 44 24 28

4 바이트 기본 벨류 : 2303974391

4 바이트 바뀔 벨류  : 2303973623

[ㅇㅇㄱㅈ(1)]cshell.dll+13DFBC

75 02 8B CF E8 ?? ?? ?? 00 5F 5E 59 C3 90 90 90

4 바이트 기본 벨류 : 3481993845

4 바이트 바뀔벨류  : 3481993844

[ㅇㅇㄱㅈ(2)]cshell.dll+140D16

75 13 50 8D 8E AC 00 00 00 E8 ?? ?? ?? 00 DD D8

4 바이트 기본 벨류 : 2370835317

4 바이트 바뀔 벨류  : 2370835316

[ㄴㄱㅅ]cshell.dll+205F8B

0F 84 DA 03 00 00 D9 84 24 74 01 00 00 D8 1D ??

4 바이트 기본 벨류 : 64652303

4 바이트 바뀔 벨류  : 64652559

[ㅋ ㅎㅂ]cshell.dll+1432E4

7E ?? 57 8D 8C 24 ?? 01 00 00 68 ?? ?? ?? ?? 51/

4 바이트 기본 벨류 : 2371304318

4 바이트 바뀔 벨류  : 2371304317

[ㅊㅁㄱ ㅁㅅ]cshell.dll+206CFB

75 30 D9 44 24 ?? D8 1D ?? ?? ?? ?? DF E0 F6 C4

4 바이트 기본 벨류 : 1155084405

4 바이트 바뀔 벨류 : 1155084404

[ㄱㅈ ㅇㅊㅇㅌ]cshell.dll+

74 36 8B 0D ?? ?? ?? 03 8D 44 24 18 50 53 8B 11

4 바이트 기본 벨류 : 227227252

4 바이트 바뀔 벨류  : 227227263

[1R ㄹㅅㅍ]cshell.dll+1793E9

75 ?? 8B ?? E8 ?? ?? ?? FF 5E C3 90 90 90 90 90

4 바이트 기본 벨류 : 3465217909

4 바이트 바뀔벨류  : 3465217908

[고스트 스텝]cshell.dll+208692

75 2c 8b 4e 14 b8 20 08 00 00

바이트 : 116

[ㅊ ㅂㅅ]cshell.dll+C6A6

4바이트 원래 벨류 : 23724138

4바이트 바뀔 벨류 : 23724394

[ㅅㄴ ㅈ]cshell+3830BC

바이트 : 1

[ㄷㅂ]cshell+38E8D4

바이트 : 0

(ㅂㅂㅈㅍ)

Bip01 R UpperArm -  오른쪽팔 [42 69 70 30 31 20 52 20 55 70 70 65 72 41 72 6D]

Bip01 L UpperArm -  왼쪽팔   [42 69 70 30 31 20 4C 20 55 70 70 65 72 41 72 6D]

Bip01 R Clavicle - 오른쪽빗장뼈 [42 69 70 30 31 20 52 20 43 6C 61 76 69 63 6C 65]

Bip01 L Clavicle - 왼쪽빗장뼈   [42 69 70 30 31 20 4C 20 43 6C 61 76 69 63 6C 65]

Bip01 R Forearm - 오른쪽팔뚝 [42 69 70 30 31 20 52 20 46 6F 72 65 61 72 6D 00]

Bip01 L Forearm - 왼쪽팔뚝 [42 69 70 30 31 20 4C 20 46 6F 72 65 61 72 6D 00]

Bip01 R Thigh - 오른쪽넓적다리 [42 69 70 30 31 20 52 20 54 68 69 67 68 00 1A 85]

Bip01 L Thigh - 왼쪽넓적다리 [42 69 70 30 31 20 4C 20 54 68 69 67 68 00 1A 85] 

Bip01 R Calf - 오른쪽종아리 [42 69 70 30 31 20 52 20 43 61 6C 66 00 00 00 00]

Bip01 L Calf - 왼쪽종아리 [42 69 70 30 31 20 4C 20 43 61 6C 66 00 00 00 00]

*패치일때마다 코드값 변겅됩니다.

*쉘값 및 각종값 코드입니다.

posted by 핵커 커뮤니티
:
게임 코드 자료실 2020. 4. 10. 16:36

#include <windows.h>

#include <detours.h>

#include <d3d8.h>

#include <d3dx8.h>

#include "log.h"

#include <fstream>

#include <iostream>

#pragma comment(lib, "d3dx8.lib")

#pragma comment(lib, "d3d8.lib")

using namespace std;

static DWORD dwBeginScene            = 0x6D9D9250;

static DWORD dwEndScene                = 0x6d9d93a0;

static DWORD dwDrawIndexedPrimitive = 0x6d9d73a0;

static DWORD dwSetStreamSource        = 0x6d9d6760;

static DWORD dwSetViewport            = 0x6d9d5b90    ;

 

 

int m_Stride;

int texnum;

int nNumVertices;

int nPrimitiveCount;

 

LPDIRECT3DTEXTURE8  Red,Yellow,Green,Blue,Purple,Pink,Orange;

bool Color = true;

bool Logger = false;

ofstream ofile;   

char dlldir[320];

float ScreenCenterX = 0.0f;

float ScreenCenterY = 0.0f;

bool xhair = false;

bool WallHack = false;

bool WallHack2 = false;

HANDLE hand1       =NULL;

HANDLE hand2       =NULL;

 

DWORD bytes;

 

//Logger

int texarray[1000];

int arraycounter;

int delarray[500];

int dcount;

unsigned int arrc;

int i=0;

 

 

D3DCOLOR redt = D3DCOLOR_XRGB( 255, 0, 0 );

 

 

char *GetDirectoryFile(char *filename)

{

    static char path[320];

    strcpy(path, dlldir);

    strcat(path, filename);

    return path;

}

 

void __cdecl add_log (const char *fmt, ...)

{

    if(ofile != NULL)

    {

        if(!fmt) { return; }

 

        va_list va_alist;

        char logbuf[256] = {0};

 

        va_start (va_alist, fmt);

        _vsnprintf (logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), fmt, va_alist);

        va_end (va_alist);

 

        ofile << logbuf << endl;

    }

}

 

HRESULT GenerateTexture(IDirect3DDevice8 *pD3Ddev, IDirect3DTexture8 **ppD3Dtex, DWORD colour32)

{

    if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex)) )

        return E_FAIL;

 

    WORD colour16 =    ((WORD)((colour32>>28)&0xF)<<12)

            |(WORD)(((colour32>>20)&0xF)<<8)

            |(WORD)(((colour32>>12)&0xF)<<4)

            |(WORD)(((colour32>>4)&0xF)<<0);

 

    D3DLOCKED_RECT d3dlr;   

    (*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);

    WORD *pDst16 = (WORD*)d3dlr.pBits;

 

    for(int xy=0; xy < 8*8; xy++)

        *pDst16++ = colour16;

 

    (*ppD3Dtex)->UnlockRect(0);

 

    return S_OK;

}

 

 

//=================================EndScene_Start=================================================================================//

typedef HRESULT ( WINAPI* oEndScene ) ( LPDIRECT3DDEVICE8 pDevice );

oEndScene pEndScene;

 

HRESULT WINAPI myEndScene(LPDIRECT3DDEVICE8 pDevice)

{

if(Color)

{

GenerateTexture(pDevice, &Red,      D3DCOLOR_ARGB    (255   ,   255  ,     0      ,    0      ));

GenerateTexture(pDevice, &Yellow,   D3DCOLOR_ARGB    (255   ,   255  ,     255    ,    0      ));

GenerateTexture(pDevice, &Green,    D3DCOLOR_ARGB    (255   ,   0    ,     255    ,    0      ));

GenerateTexture(pDevice, &Blue,     D3DCOLOR_ARGB    (255   ,   0    ,     0      ,    255    ));

GenerateTexture(pDevice, &Purple,   D3DCOLOR_ARGB    (255   ,   102  ,     0      ,    153    ));

GenerateTexture(pDevice, &Pink,     D3DCOLOR_ARGB    (255   ,   255  ,     20      ,   147    ));

GenerateTexture(pDevice, &Orange,   D3DCOLOR_ARGB    (255   ,   255  ,     165      ,  0      ));

Color=false;

}

 

if(xhair)

{

  D3DRECT rec2 = {ScreenCenterX-20, ScreenCenterY, ScreenCenterX+ 20, ScreenCenterY+2};

  D3DRECT rec3 = {ScreenCenterX, ScreenCenterY-20, ScreenCenterX+ 2,ScreenCenterY+20};

  pDevice->Clear(1, &rec2, D3DCLEAR_TARGET,redt, 0,  0);

  pDevice->Clear(1, &rec3, D3DCLEAR_TARGET,redt, 0,  0);

}   

 

//=============================================UnHooK_Start===================================================//

 

if((GetAsyncKeyState(VK_F5)&1))       

{   

int end    =NULL;

int dip    =NULL;

int svp    =NULL;

int sss    =NULL;

 

 

BYTE Unhook[5] = {0x8B,0xFF,0x55,0x8B,0xEC};//Original Function Bytes.

hand1 = GetCurrentProcess();

DWORD dwmodualBase=(DWORD)GetModuleHandle("d3d8.dll");

end = 0x6d9d93a0;

dip = 0x6d9d73a0;

svp = 0x6d9d5b90;

sss = 0x6d9d6760;

 

WriteProcessMemory(hand1, (void*) end, Unhook, 5, &bytes);

WriteProcessMemory(hand1, (void*) dip, Unhook, 5, &bytes);

WriteProcessMemory(hand1, (void*) svp ,Unhook, 5, &bytes);

WriteProcessMemory(hand1, (void*) sss,Unhook, 5, &bytes);

}   

//=========================================UnHook_End=========================================================//

 

if((GetAsyncKeyState(VK_F1)&1)){xhair=!xhair;}       

if((GetAsyncKeyState(VK_F2)&1)){WallHack=!WallHack;}       

 

return pEndScene(pDevice);

}

//====================================EndScene_End============================================================================//

 

 

 

 

//=================================Dip_Start============================================================================================//

typedef HRESULT ( WINAPI* oDrawIndexedPrimitive ) ( LPDIRECT3DDEVICE8 pDevice, D3DPRIMITIVETYPE pType, UINT nMinIndex, UINT nNumVertices, UINT nStartIndex, UINT nPrimitiveCount );

oDrawIndexedPrimitive pDrawIndexedPrimitive;

 

HRESULT WINAPI myDrawIndexedPrimitive(LPDIRECT3DDEVICE8 pDevice, D3DPRIMITIVETYPE pType, UINT nMinIndex, UINT nNumVertices, UINT nStartIndex, UINT nPrimitiveCount)

{

 

 

 

 

if(WallHack)

{

texnum = (nNumVertices*100000)+nPrimitiveCount;

    if(m_Stride==40 &&

 

  (texnum==7500121 )||(texnum==8500105 )||(texnum==12400168)||(texnum==37000650)||

  (texnum==18000274)||(texnum==8800105 )||(texnum==36900650)||(texnum==19600314)||

  (texnum==21800306)||(texnum==7500121 )||(texnum==8500105 )||(texnum==12400168)||

  (texnum==21800306)||(texnum==36900650)||(texnum==7500121 )||(texnum==37000650)||

  (texnum==18000274)||(texnum==7500121 )||(texnum==8500105 )||(texnum==38000658)||

  (texnum==22100268)||(texnum==62400752)||(texnum==27900456)||(texnum==45700654)||

  (texnum==4800040 )||(texnum==83600752)||(texnum==33400477)||(texnum==38100666)||

  (texnum==2800036 )||(texnum==62400752)||(texnum==29700492)||(texnum==84900778)||

  (texnum==27500442)||(texnum==52100658)||(texnum==62400752)||(texnum==33600552)||

  (texnum==44100646)||(texnum==18000274)||(texnum==37200508)||(texnum==45700654)||

  (texnum==37200508)||(texnum==52100658)||(texnum==52100658) &&

 

 

 

     (nNumVertices == 100 && nPrimitiveCount == 121) || //Foot

     (nNumVertices == 105 && nPrimitiveCount == 168) || //Right Arm

     (nNumVertices == 132 && nPrimitiveCount == 180) || //Hand

     (nNumVertices == 159 && nPrimitiveCount == 200) || //Left Arm

     (nNumVertices == 338 && nPrimitiveCount == 534) || //Underbody    thanks japennese guy =)

     //(nNumVertices == 448 && nPrimitiveCount == 776) || //Head

     (nNumVertices == 804 && nPrimitiveCount == 1016) || //Body //SRG Option item

     (nNumVertices == 109 && nPrimitiveCount == 110) || //Bulletproof Vest

     (nNumVertices == 336 && nPrimitiveCount == 532)) //Battle Pants

 

{

pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);

pDevice->SetTexture(0,Orange);

//pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME );

 

pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);

 

//pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID );

pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);

pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);

pDevice->SetTexture(0,Pink);

}           

 

if(m_Stride==40 && texnum== 21300174)   

{

pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);

pDevice->SetTexture(0,Green);//GreenNade

pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);

pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);

pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);

pDevice->SetTexture(0,Purple);

}      

 

 

if(nNumVertices == 158 && nPrimitiveCount == 131)

{

pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);

pDevice->SetTexture(0,Red);//GreenNade

pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);

pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);

pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);

pDevice->SetTexture(0,Yellow);

}

 

if (nNumVertices == 171 && nPrimitiveCount == 143)

{

 

pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER);

pDevice->SetTexture(0,Red);//GreenNade

pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);

pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);

pDevice->SetRenderState(D3DRS_ZFUNC,D3DCMP_LESSEQUAL);

pDevice->SetTexture(0,Yellow);

}

 

 

 

if(m_Stride==40 &&//face,mask etc...

(texnum==36700612) ||

(texnum==9600172 ) ||

(texnum==14200236) ||

(texnum==37800552) ||

(texnum==28100486) ||

(texnum==35500568) ||

(texnum==2200024 ) ||

(texnum==16200243) ||

(texnum==31900466) ||

(texnum==19300342) ||

(texnum==36200604) ||

(texnum==21300290) ||

(texnum==35700558) ||

(texnum==22100396) ||

(texnum==36100604) ||

(texnum==27100464) ||

(texnum==11400180) ||

(texnum==34900580) ||

(texnum==13200212) ||

(texnum==34700538) ||

(texnum==19500352)&&

(nNumVertices == 448 && nPrimitiveCount == 776))

 

{

pDevice->SetTexture(0,Blue);

}

 

 

{

pDevice->SetRenderState(D3DRS_FOGENABLE,false);

}

 

/*Logger

if(m_Stride==40){

 

 

 while(GetAsyncKeyState(VK_NUMPAD1)&1) arrc--; //Used as manual index for adding textures to delarray

    while(GetAsyncKeyState(VK_NUMPAD3)&1) arrc++;

    bool alrdy=false;

    bool inarr=false;

 

        if(texarray[arrc]==texnum)

            if(delarray[i]==texarray[arrc])

            alrdy=true;

    for(int i=0;i<dcount;i++) //sees if said texture is in delarray

        if(delarray[i]==texnum)

            inarr=true;

    if(texarray[arrc]==texnum || inarr){ //If true, color model differently

        LPDIRECT3DTEXTURE8 texCol;

            DWORD dwOldZEnable = D3DZB_TRUE;

            pDevice->SetTexture(0, NULL);

            pDevice->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable);

            pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);

            if(alrdy) //Different colors for selected models that are already being logged (For removal from array)

                texCol=Blue;

            else

                texCol=Red;

           pDevice->SetTexture(0, texCol);

            pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);

            pDevice->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);

 

    }

}

if(GetAsyncKeyState(VK_F5)&1) add_log("Logged tesx: %i", texarray[arrc]); //F5 will print currently selected texnum to logfile

if(GetAsyncKeyState(VK_F6)&1) { //For adding/removing textures to array

    bool inarr=true;

    for(int k=0;k<dcount;k++){

        if(delarray[k]==texarray[arrc])

        {

            inarr=false;//Found selected texture to already exist

            delarray[k]=0;//Delete texture

            break;//Cancel loop

        }

    }

    if(inarr==true)

    {

    delarray[dcount]=texarray[arrc];//Add texture

    dcount++;

    }

}

if(GetAsyncKeyState(VK_F7)&1){

int total=1;

    add_log("omfg values?!? {");

    for(int x=0;x<dcount;x++)//Loops through all recorded variables and prints them in a nice array based format

        if(delarray[x]){

            add_log("%i,",delarray[x]); //add_log2==add_log but without endl

            total++;

        }

    add_log("}; %i variables in array",total);

}

bool found = false; //THIS PART CREDITS TO KRYPTEC

for(int y=0; y<arraycounter; y++) //THIS IS HIS LOGGING FUNCTION

{

    if(texnum==texarray[y])found=true; //I JUST CREATED AN INTERFACE FOR IT

}

    if(!found && arraycounter < 1000)

    {

    texarray[arraycounter]=texnum;

    arraycounter++;

    }*/

 

 

}

return pDrawIndexedPrimitive(pDevice, pType, nMinIndex, nNumVertices, nStartIndex, nPrimitiveCount);

}

//=====================================Dip_End===========================================================================//

 

 

//=====================================Sss_Start==========================================================================//

typedef HRESULT ( WINAPI* oSetStreamSource ) ( LPDIRECT3DDEVICE8 pDevice, UINT nStreamNumber, LPDIRECT3DVERTEXBUFFER8 pStreamData, UINT nStride );

oSetStreamSource pSetStreamSource;

 

HRESULT WINAPI mySetStreamSource(LPDIRECT3DDEVICE8 pDevice, UINT nStreamNumber, LPDIRECT3DVERTEXBUFFER8 pStreamData, UINT nStride)

{

        if(nStreamNumber==0)

        m_Stride = nStride;

 

    return pSetStreamSource(pDevice, nStreamNumber, pStreamData, nStride);

}

//====================================Sss_End============================================================================//

 

//====================================Svp_Start==========================================================================//

typedef HRESULT (WINAPI* oSetViewport)(LPDIRECT3DDEVICE8 pDevice,CONST D3DVIEWPORT8* pViewport);

oSetViewport pSetViewport;

 

HRESULT WINAPI mySetViewport(LPDIRECT3DDEVICE8 pDevice,CONST D3DVIEWPORT8* pViewport)

{

    ScreenCenterX = ( float )pViewport->Width / 2;

    ScreenCenterY = ( float )pViewport->Height / 2;   

 

    return pSetViewport(pDevice,pViewport);

}

//===================================Svp_End=============================================================================//

 

typedef HRESULT ( WINAPI* oBeginScene ) ( LPDIRECT3DDEVICE8 pDevice );

oBeginScene pBeginScene;

 

HRESULT WINAPI myBeginScene(LPDIRECT3DDEVICE8 pDevice)

{

    if((GetAsyncKeyState(VK_F6)&1))   

    {

        pEndScene = (oEndScene)DetourFunction((PBYTE)dwEndScene, (PBYTE)myEndScene);

        pDrawIndexedPrimitive = (oDrawIndexedPrimitive)DetourFunction((PBYTE)dwDrawIndexedPrimitive, (PBYTE)myDrawIndexedPrimitive);

        pSetStreamSource = (oSetStreamSource)DetourFunction((PBYTE)dwSetStreamSource, (PBYTE)mySetStreamSource);

        pSetViewport=(oSetViewport)DetourFunction((PBYTE)dwSetViewport,(PBYTE)mySetViewport);

    }

 

    return pBeginScene(pDevice);

}

 

 

BOOL WINAPI DllMain ( HMODULE hModule, DWORD dwReason, LPVOID lpReserved )

{

    DisableThreadLibraryCalls(hModule);

 

    if ( dwReason == DLL_PROCESS_ATTACH )

    {

 

        //=========Log==========================//

        GetModuleFileName(hModule, dlldir, 512);

        for(int i = strlen(dlldir); i > 0; i--) { if(dlldir[i] == '\\') { dlldir[i+1] = 0; break; } }

        ofile.open(GetDirectoryFile("log.txt"), ios::app);   

        //=========Log=========================//

 

        pBeginScene = (oBeginScene)DetourFunction((PBYTE)dwBeginScene, (PBYTE)myBeginScene);

        pEndScene = (oEndScene)DetourFunction((PBYTE)dwEndScene, (PBYTE)myEndScene);

        pDrawIndexedPrimitive = (oDrawIndexedPrimitive)DetourFunction((PBYTE)dwDrawIndexedPrimitive, (PBYTE)myDrawIndexedPrimitive);

        pSetStreamSource = (oSetStreamSource)DetourFunction((PBYTE)dwSetStreamSource, (PBYTE)mySetStreamSource);

        pSetViewport=(oSetViewport)DetourFunction((PBYTE)dwSetViewport,(PBYTE)mySetViewport);

 

}

return TRUE;

}

--------------------

[log.h]

#define WIN32_LEAN_AND_MEAN

 

#ifndef _MAIN_H

#define _MAIN_H

 

char *GetDirectoryFile(char *filename);

void __cdecl add_log (const char * fmt, ...);

#endif 

--------------------

*기본소스 예제입니다

*C++ 기반

posted by 핵커 커뮤니티
:
Olly_Dbg 2020. 4. 10. 16:34

프로그램은 기본적으로

출발지점(EP -> Entry Point)를 기점으로 순서대로 실행이 된다.

[기본적인 단축키]

ctrl+F2 // 재시작

F7 // 한줄 한줄 실행 (안으로 자세히 들어감)

F8 // 한줄 한줄 실행 그냥 넘어가기 (자세히 안봄)

ctrl+G // 가고싶은 주소에 한번에 갈 수 있음

; // 주석

F2 // 브레이크 포인트 설정

F9 // 브레이크 포인트 까지 실행

* // 현재 위치

Enter // 안을 자세히 들어가볼 수 있음

Ctrl+E // 덤프 창 내용 수정

[기본적인 어셈블리어 명령어]

CALL 호출(함수, 등)

PUSH 밀어넣는다. 스택에 쌓임.

RETN 되돌아간다. 함수를 끝낸다.

INC 1을 증가시킨다.

DEC 1을 감소시킨다.

CMP 비교한다.

JMP 점프 (1보다 크면 점프해라 등 조건 가능)

-JE 같으면 점프해라

-JNE 다르면 점프해라

-JG 크면 점프해라

-JL 작으면 점프해라

-JNG 크지않으면 점프해라 = JL

-JNL 작지않으면 점프해라 = JG

-JGE 크거나 같으면 점프해라

-JLE 작거나 같으면 점프해라

기본적으로 알면 좋은 단축키입니다. ^_^

'Olly_Dbg' 카테고리의 다른 글

[Olly_Dbg] 올리디버거 다운로드 (1.10Ver)  (0) 2020.04.14
posted by 핵커 커뮤니티
:
AssemBly 2020. 4. 10. 16:19

* 사용 CPU, 문법

- intel 32bit, intel 문법

** 어셈블리어 문법은 두가지가 있다

- Intel 문법 (윈도우에서 사용)

- AT&T 문법 (리눅스에서 사용)

1. RAM , ROM

메모리는 크게 RAM  ROM 으로 나뉜다.

1.1 RAM (Random Access Memory)

- 휘발성 ( 전원이 꺼지면 저장되었던 데이터들이 모두 사라짐)

- 컴퓨터의 주기억장치

- 응용 프로그램의 일시적 로딩

- 데이터의 일시적 저장

- 읽고 쓰는 속도가 매우 빠르다

1.2 ROM (Read Only Memory)

- 불휘발성 ( 전원이 꺼져도 데이터가 남아있음 )

- 고정기억장치

- 컴퓨터의 동작순서 같은 데이터 저장

2. CPU, RAM, Hard Disk

컴퓨터의 메인보드를 살펴보면 CPU의 주변에 RAM이 존재하고(ram을 꽂을 수 있는 메모리 슬롯) 제법 떨어진 곳에 Hard Disk가 존재하는 것을 볼 수 있다.

그렇다면 왜 Hard Disk 가 아닌 RAM이 주기억장치 일까?

2.1 비교

메모리는 그 속도가 CUP와 근접할 수록 빠르다.

속도의 순위를 매기자면

1. register (cpu 내부에 존재)

2. ram

3. hard disk

하지만 용량은 그 순위의 역순이다.

hard disk는 그 용량이 크지만 속도가 너무 느리기 때문에 주기억장치가 될 수 없으며, register는 속도가 매우 빠르지만 용량이 너무 적기 때문에 ram이 주기억장치가 된것이다.

3. RAM의 작동방식 (memory의 작동방식) - 가독성을 위해 한줄씩 띄어쓰기 함.

CPU는 RAM에서 데이터를 받아 연산을 수행한다. 그렇다면 RAM의 작동방식은 어떠할까?

3.1 CPU와 RAM

1 bit 의 메모리를 1개의 상자라고 생각하자.

그렇다면 8bit(1byte)의 메모리는 상자 8개의 묶음(이음)일 것이다.

메모리를 늘리기 위해선 그저 상자를 추가하면 된다.

만약 1GB의 메모리가 있다면 그것은 8 * 1024 * 1024 * 1024 = 8589934592 개의 상자로 이루어졌다고 생각하면 된다.

RAM의 CPU에서 정보를 전달해주어야 하기 때문에 상자마다 CPU와 연결되어 있다고 가정하자.

그렇다면 CPU와 RAM 사이에는 8589934592개의 연결이 필요하다.

실제로 CPU와 RAM은 CPU의 핀으로 정보를 주고 받는데 이 핀이 8589934592개라면 CPU의 크기가 굉장히 커야 할 것이다.

따라서 RAM과 CPU의 연결은 bit 하나하나의 연결이 아닌 하나의 주소와의 연결로 이루어져 있다.

3.1.1 메모리 주소

하나의 주소는 하나의 상자 묶음을 가리킨다. (한쌍)

상자묶음의 크기는 그 PC의 운영체제 ( 16bit, 32bit, 64bit )에 따라 다르며, 만약 32bit 운영체제라면 상자묶음의

크기가 32bit, 즉 32개의 상자로 이루어져 있다는 것을 뜻한다.

ram의 크기는 주소와 상자묶음 한쌍의 갯수를 의미한다. 즉, 4GB 짜리 ram에는 각기 다른 주소와 상자묶음이 한 쌍으로 8 * 4G 개 있다는 것이다.

4GB RAM >>

0 - ㅁㅁ....ㅁㅁ

1 - ㅁㅁ....ㅁㅁ

.

.

.

8*4G -2 - ㅁㅁ .... ㅁㅁ

8*4G -1 - ㅁㅁ .... ㅁㅁ (0부터 시작하니까 -1을 해준다)

4. MOV 명령어와 메모리주소

메모리 주소의 표기법 = [ 주소 ]

Ex ->

[00402001] , [02130423] 등..

4.1 OllyDbg로 주소 보기

주소는 Hex 값(16진수)

- 왼편 : Address 16의 1승 자리 씩 증가

- 오른편 : 왼편의 Address에 대한 16의 0승 자리의 나열

4.2 mov 명령어와 메모리 주소

Ex ->

mov [0040200], eax

** 주의사항

'mov 메모리, 메모리' (불가)

-> 1. mov reg, 메모리

2. mov 메모리, reg (가능)

4.3 메모리 크기 지정

위의 명령어를 입력하면 명령어가 자동으로 아래의 사진처럼 변경된다.

mov [402000], eax

-> mov dword ptr ds:[402000], eax

 

이것은 reg의 크기에 따라 달라지는데...

mov dword ptr ds:[402000], eax

mov word ptr ds:[402000], ax

mov byte ptr ds:[402000], al

여기서 dword, word, byte에 대해 알아보겠다.

4.3.1 DWORD, WORD, BYTE

BYTE 는 말그대로 1 byte의 크기를 의미한다.

WORD 는 2byte의 크기를 의미하고

DWORD 는 4byte의 크기를 의미한다.

이것은 각각 register의 크기에 맞추어 명령어에 들어가야할 필수 입력 정보이다.

dword - eax

word - ax

byte - al,ah

그러나 이것은 편의를 위해 사용자가 mov [402000], eax 만 입력을 하더라도 디버거가 자동으로 reg의 크기를 읽어 앞에 붙여준다.

4.3.2 WORD가 2byte인 이유.

DWORD는 사실 32bit 운영체제가 되면서 만들어진 것이다.

16bit 운영체제 당시 WORD는 16bit를 의미하였으며 이 전통이 32bit 운영체제가 되면서까지 이어진 것이다.

4.3.3 PTR

명령어를 다시 보면 dword 뒤에 ptr이란것이 붙는다. c언어를 공부했다면 ptr이 포인터를 의미한다는 것을 알 것이다.

뒤에 붙은 ptr은 앞에 붙은 용량을 뜻하는 문자와 합쳐져

"지금 이 명령은 피연산자(operand)의 용량중 dowrd 만큼의 공간을 이용합니다!" 라는 뜻을 갖는다.

4.3.4 메모리 크기 지정은 반드시 필요하다.

디버거가 mov [주소], reg 의 명령에서는 reg의 크기를 읽어서 자동으로 메모리 크기 지정을 해주지만 reg가 아닌 직접 값을 집어 넣으려고 할때는 반드시 직접 메모리 크기 지정을 해주어야 한다.

Ex ->

= 불가

= 가능

'AssemBly' 카테고리의 다른 글

[AssemBly] 기본적인 명령어 모음  (0) 2020.04.10
[AssemBly] 기초 명령어 소개  (0) 2020.04.10
posted by 핵커 커뮤니티
:
AssemBly 2020. 4. 10. 16:16

기본적인 어셈블리 명령어

명 령 어

설 명

Data Transfer

MOV

Move

데이터 이동 (전송)

PUSH

Push

오퍼랜드의 내용을 스택에 쌓는다

POP

Pop

스택으로부터 값을 뽑아낸다.

XCHG

Exchange Register/memory with Register

첫 번째 오퍼랜드와 두 번째 오퍼랜드 교환

IN

Input from AL/AX to Fixed port

오퍼랜드로 지시된 포트로부터 AX에 데이터 입력

OUT

Output from AL/AX to Fixed port

오퍼랜드가 지시한 포트로 AX의 데이터 출력

XLAT

Translate byte to AL

BX:AL이 지시한 데이블의 내용을 AL로 로드

LEA

Load Effective Address to Register

메모리의 오프셋값을 레지스터로 로드

LDS

Load Pointer to DS

REG←(MEM), DS←(MEM+2)

LES

Load Pointer ti ES

REG←(MEM), ES←(MEM+2)

LAHF

Load AH with Flags

플래그의 내용을 AH의 특정 비트로 로드

SAHF

Store AH into Flags

AH의 특정 비트가 플래그 레지스터로 전송

PUSHF

Push Flags

플래그 레지스터의 내용을 스택에 쌓음

POPF

Pop Flags

스택으로부터 플래그 레지스터로 뽑음

Arithmetic

ADD

Add

캐리를 포함하지 않은 덧셈

SBB

Subtract with Borrow

캐리를 포함한 뺄셈

DEC

Decrement

오퍼랜드 내용을 1 감소

NEG

Change Sign

오퍼랜드의 2의 보수, 즉 부호 반전

CMP

Compare

두 개의 오퍼랜드를 비교한다

ADC

Add with Carry

캐리를 포함한 덧셈

INC

Increment

오퍼랜드 내용을 1 증가

AAA

ASCII adjust for Add

덧셈 결과 AL값을 UNPACK 10진수로 보정

DAA

Decimal adjust for Add

덧셈 결과의 AL값을 PACK 10진수로 보정

SUB

Subtract

캐리를 포함하지 않은 뺄셈

AAS

ASCII adjust for Subtract

뺄셈 결과 AL값을 UNPACK 10진수로 보정

DAS

Decimal adjust for Subtract

뺄셈 결과의 AL값을 PACK 10진수로 보정

MUL

Multiply (Unsigned)

AX와 오퍼랜드를 곱셈하여 결과를 AX 또는 DX:AX에 저장

IMUL

Integer Multiply (Signed)

부호화된 곱셈

AAM

ASCII adjust for Multiply

곱셈 결과 AX값을 UNPACK 10진수로 보정

DIV

Divide (Unsigned)

AX 또는 DX:AX 내용을 오퍼랜드로 나눔. 몫은 AL, AX 나머지는 AH, DX로 저장

IDIV

Integer Divide (Signed)

부호화된 나눗셈

AAD

ASCII adjust for Divide

나눗셈 결과 AX값을 UNPACK 10진수로 보정

CBW

Convert byte to word

AL의 바이트 데이터를 부호 비트를 포함하여 AX 워드로 확장

CWD

Convert word to double word

AX의 워드 데이터를 부호를 포함하여 DX:AX의 더블 워드로 변환

Logic

NOT

Invert

오퍼랜드의 1의 보수, 즉 비트 반전

SHL/SAL

Shift logical / arithmetic Left

왼쪽으로 오퍼랜드만큼 자리 이동 (최하위 비트는 0)

SHR

Shift logical Right

오른쪽으로 오퍼랜드만큼 자리 이동 (최상위 비트 0)

SAR

Shift arithmetic Right

오른쪽 자리이동, 최상위 비트는 유지

ROL

Rotate Left

왼쪽으로 오퍼랜드만큼 회전 이동

ROR

Rotate Right

오른쪽으로 오퍼랜드만큼 회전 이동

RCL

Rotate through Carry Left

캐리를 포함하여 왼쪽으로 오퍼랜드만큼 회전 이동

RCR

Rotate through Carry Right

캐리를 포함하여 오른쪽으로 오퍼랜드만큼 회전 이동

AND

And

논리 AND

TEST

And function to Flags, no result

첫 번째 오퍼랜드와 두 번째 오퍼랜드를 AND하여 그 결과로 플래그 세트

OR

Or

논리 OR

XOR

Exclusive Or

배타 논리 합 (OR)

String Manipulation

REP

Repeat

REP 뒤에 오는 스트링 명령을 CX가 0이 될 때까지 반복

MOVS

Move String

DS:SI가 지시한 메모리 데이터를 ES:DI가지시한 메모리로 전송

CMPS

Compare String

DS:SI와 ES:DI의 내용을 비교하고 결과에 따라 플래그 설정

SCAS

Scan String

AL 또는 AX와 ES:DI가 지시한 메모리 내용 비교하고 결과에 따라 플래그 설정

LODS

Load String

SI 내용을 AL 또는 AX로 로드

STOS

Store String

AL 또는 AX를 ES:DI가 지시하는 메모리에 저장

Control Transfer

CALL

Call

프로시저 호출

JMP

Unconditional Jump

무조건 분기

RET

Return from CALL

CALL로 스택에 PUSH된 주소로 복귀

JE/JZ

Jump on Equal / Zero

결과가 0이면 분기

JL/JNGE

Jump on Less / not Greater or Equal

결과가 작으면 분기 (부호화된 수)

JB/JNAE

Jump on Below / not Above or Equal

결과가 작으면 분기 (부호화 안 된 수)

JBE/JNA

Jump on Below or Equal / not Above

결과가 작거나 같으면 분기 (부호화 안 된 수)

JP/JPE

Jump on Parity / Parity Even

패리티 플레그가 1이면 분기

JO

Jump on Overflow

오버플로가 발생하면 분기

JS

Jump on Sign

부호 플레그가 1이면 분기

JNE/JNZ

Jump on not Equal / not Zero

결과가 0이 아니면 분기

JNL/JGE

Jump on not Less / Greater or Equal

결과가 크거나 같으면 분기 (부호화된 수)

JNLE/JG

Jump on not Less or Equal / Greater

결과가 크면 분기 (부호화된 수)

JNB/JAE

Jump on not Below / Above or Equal

결과가 크거나 같으면 분기 (부호화 안 된 수)

JNBE/JA

Jump on not Below or Equal / Above

결과가 크면 분기 (부호화 안 된 수)

JNP/JPO

Jump on not Parity / Parity odd

패리티 플레그가 0이면 분기

JNO

Jump on not Overflow

오버플로우가 아닌 경우 분기

JNS

Jump on not Sign

부호 플레그가 0이면 분기

LOOP

Loop CX times

CX를 1감소하면서 0이 될 때까지 지정된 라벨로 분기

LOOPZ/LOOPE

Loop while Zero / Equal

제로 플레그가 1이고 CX≠0이면 지정된 라벨로 분기

LOOPNZ/LOOPNE

Loop while not Zero / not Equal

제로 플레그가 0이고 CX≠0이면 지정된 라벨로 분기

JCXZ

Jump on CX Zero

CX가 0이면 분기

INT

Interrupt

인터럽트 실행

INTO

Interrupt on Overflow

오버플로우가 발생하면 인터럽트 실행

IRET

Interrupt Return

인터럽트 복귀 (리턴)

Processor Control

CLC

Clear Carry

캐리 플레그 클리어

CMC

Complement Carry

캐리 플레그를 반전

CLD

Clear Direction

디렉션 플레그를 클리어

CLI

Clear Interrupt

인터럽트 플레그를 클리어

HLT

Halt

정지

LOCK

Bus Lock prefix

STC

Set Carry

캐리 플레그 셋

NOP

No operation

STD

Set Direction

디렉션 플레그 셋

STI

Set Interrupt

인터럽트 인에이블 플레그 셋

WAIT

Wait

프로세서를 일지 정지 상태로 한다

ESC

Escape to External device

이스케이프 명령

2. 8086 어셈블러 지시어(Directive)

지시어

내 용

형 식

SEGMENT

-

END

어셈블리 프로그램은 한 개 이상의 세그먼트들로 구성된다. SEGMENT 지시어는 하나의 세그먼트를 정의한다.

segname SEGMENT ; 세그먼트 시작

⋮ ; 세그먼트 내용

segname ENDS ; 세그먼트 끝

PROC

-

ENDP

매크로 어셈블리에서는 프로그램의 실행 부분을 모듈로 작성할 수 있다. 이 모듈을 프로시저(Procedure)라 부르며, PROC 지시어가 이를 정의한다.

procname PROC ; 프로시저의 시작

⋮ ; 프로시저의 내용

procname ENDP ; 프로시저의 끝

ASSUME

어셈블러에게 세그먼트 레지스터와 사용자가 작성한 세그먼트의 이름을 연결시킨다.

ASSUME SS:stack_segname,

DS:data_segname,

CS:code_segname,

ES:extra_segname

END

전제 프로그램의 끝을 나타냄

END

데이터 정의 지시어 : 프로그램에서 데이터를 저장할 기억 장소를 정의, 초기값 부여

DB

Define Byte

name DB 초기값

DW

Define Word

name DW 초기값

DD

Define Double Word

name DD 초기값

DQ

Define Quad Word

name DQ 초기값

DT

Define Ten Bytes

name DT 초기값

EQU

변수 이름에 데이터값이나 문자열 정의

name EQU 데이터값/문자열

=

EQU와 달리 정의된 값을 변경 가능

EVEN

어셈블리시 이 지시어가 사용되는 곳의 주소가 짝수로 되도록 함

PAGE

어셈블리 리스트의 형식을 결정

PAGE [length][,width]

TITLE

어셈블리 리스트의 각 페이지에 제목 출력

TITLE text

※ 세그먼트(SEGMENT)와 오프셋(OFFSET)

16비트 레지스터를 사용하여 주소를 표현한다면, 216Byte = 65536 Byte = 64 KByte 의 주소 공간을 가질 수 있다. 그러나 지정 가능 주소 공간의 크기를 늘리기 위하여

'세그먼트', '오프셋'의 개념을 사용한다. 개념적으로는 메모리를 가리키는 화살표를

세그먼트(SEGMENT)라고 하고 그곳을 기준으로 떨어진 변위(DISPLACEMENT)를

오프셋(OFFSET)이라고 한다.

8086은 세그먼트를 16바이트 단위로 취하여 그곳으로부터 오프셋 지정으로 주소값을 얻는다.

세그먼트값 × 16 + 오프셋 = 실제주소

16을 곱한다는 것은 왼쪽으로 4번 시프트 한것과 같다. 이 때, 세그먼트 레지스터는

16비트이므로 실제 주소는 16비트를 왼쪽으로 4번 시프트한 20비트의 주소 공간을

가리킬 수 있게된다.

예를 들어, 세그먼트가 A000, 오프셋이 00FF 일 때 실제 주소 값은 다음과 같이 계산할 수 있다.

A

0

0

0

세그먼트

+

0

0

F

F

오프셋

A

0

0

F

F

실제 주소값

이러한 세그먼트, 오프셋에 의한 방식의 장점은 작은 레지스터 크기로도

넓은 주소 공간을 가리킬 수 있다는 것이다.

8086의 경우 20비트의 주소 공간이므로 220Byte = 1048576 Byte = 1 MByte 까지의 주소 공간을 가질 수 있다.

'AssemBly' 카테고리의 다른 글

[AssemBly] 메모리 기초강의  (0) 2020.04.10
[AssemBly] 기초 명령어 소개  (0) 2020.04.10
posted by 핵커 커뮤니티
: