Design method of four online game plugins (four)

xiaoxiao2021-03-06  43

Accelerated plug-in, I have always thought that acceleration plug-in is written for a game. Later, I found that this concept is wrong. The so-called accelerated plug is actually the purpose of modifying clock frequencies to accelerate. In the past DOS era, people played programming immediately thought that this is very simple, it is not to change the 8253 register. This may be able to travel in the previous DOS era, but Windows is not. Windows is a 32-bit operating system. It is not what you want to change (Microsoft's stuff is so domineering, say no change to you), but it is not impossible, we can Implementation by two methods: The first is to write a hardware driver, the second is to implement it with RING0 (this method is the author of CIH Chen Yinghao first, its principle is to modify the IDE table -> Create an interrupt Door -> Enter Ring0-> Call the interrupt modification vector, but there is no way to implement this * _ *, as a senior language user!), Use the first method to trouble, so we Here, use the second method to implement it ~~~ We will take a look before implementation: 1, we must first write a process to embed the assembly language in this process to implement the IDE table, create interrupt gate, modify vector Waiting for work 2, call this process to achieve acceleration function, now I have the way, let's take a look at the code: First we build a process, this process is the core part of this program:

Procedure String (Value: Word); stdcall; const zdh = $ 03; // set a interrupt number Varidt: array [0..5] of byte; // Save the IDT table OG: dword; // Store the old vector Beginasmpush Ebxsidt IDT // Read Interrupt Description Mark EBX, DWORD PTR [IDT 2] // IDT Subterite Add EBX, 8 * ZDH // Calculation Interrupt In Interrupt Descript Table CLI // Off Interrupt MOV DX, Word PTR [EBX 6] SHL EDX, 16D MOV DX, WORD PTR [EBX] MOV [OG], EDX MOV EAX, OFFSET @@ Ring0 // Pointing Ring0 Grade Dip Segment MOV Word PTR [EBX], AX // Low 16-bit, save in 1, 2-bit SHR EAX, 16DMOV Word PTR [EBX 6], AX // High 16-bit, save at 6, 7-bit int zdh // interrupt MOV EBX, DWORD PTR [Idt 2] / / Repositioning add ebx, 8 * zdhmov edx, [og] MOV WORD PTR [EBX], DXSHR EDX, 16DMOV WORD PTR [EBX 6], DX // Restore Changed Vector Pop ebxjmp @@ EXISM / / EXITASM @@ Ring0: // Ring0, this is also the most core Dongdong MOV Al, $ 34 // Write 8253 Control Register OUT $ 43, Almov AX, Value // Write Time OUT $ 40, Al // Write Timed value low MOV Al, AHOUT $ 40, Al // WrT value High IRETD // Return @@ EXITASM: END; END; The most core thing is already finished, most readers know it, I don't know how it is, huh, huh. However, I don't know if it happened. Let's try to use this process to do a place similar to the "shifting gear"! Put a window first, put a TrackBar control on the window to set it to 20, MIN is set to 1, set the position to 10, write in the Change event of this control:

String (Strtoint ('$' INTTOSTR (1742 (10-TRACKBAR1.POSITION) * 160)))

Because the default value of Windows is $ 1742, we use the 1742 as the base, but because the value is, the faster, the thicker is the slower principle, so write such a formula, which is a "shifting gear" a Delphi ASM version (Only for Win9X), huh, try it, this will help you, huh, huh. In Win2000, we can't achieve it directly, Ring0 is also lost, and some people will think that we can write drivers to complete, but here I tell you, Windows2000 drivers are not a VXD It can be realized, like my low hand does not write the drive WDM used by Windows, there is no way, I only have a good implementation, Prottalk is a good device driver, which is very convenient to achieve low-level ports. Operation, thereby achieving acceleration plugging. 1. Let's first have the next porttalk driver, his official website is http://www.beyondlogic.org 2, we have to copy the protttalk.sys inside. 3, build a protalk.sys interface (I want to omit, everyone can go at http://www.freewebs.com/liuyue/porttalk.pas Next PAS file yourself) 4, achieve acceleration plug-in. Let's talk about this process, if you use Prottalk to operate port, it is easy to operate more than Win98. 1. Create a new project to copy the interface files and protalk.sys to the folder saved by the project file. 2, we join our newly built project UsesWindows, Prottalk ...

3, we build a process

Procedure String (Value: Word); Beginif Not OpenPostTalk Then Exit; Outportb ($ 43, $ 34); OutPortb ($ 40, LO (Value)); Outprotb ($ 40, Hi (Value)); Closeporttalk; End;

4, first plus a window, put a TRACKBAR control on the window to set its max to 20, MIN is set to 1, set the position to 10, write on this control:

String (Strtoint ('$' INTTOSTR (1742 (10-TRACKBAR1.POSITION) * 160)))

It's so easy.

转载请注明原文地址:https://www.9cbs.com/read-57367.html

New Post(0)