Register for your free account! | Forgot your password?
Rust Cheats

Go Back   elitepvpers > Popular Games > Metin2 > Metin2 Private Server > Metin2 PServer Guides & Strategies
You last visited: Today at 17:17

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[?RELEASE?]Source(ugly, untested) of /dice fix

Discussion on [?RELEASE?]Source(ugly, untested) of /dice fix within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.

Reply
 
Old   #1

 
elite*gold: 0
Join Date: Jan 2013
Posts: 348
Received Thanks: 353
[?RELEASE?]Source(ugly, untested) of /dice fix

Heyho,

ich weiß nicht obs funtzt oder nicht, und ja ich weiß die Source ist hässlich,
ich hatte diese ganzen Threads von wegen Fix für die /dice Funktion gefunden und habe dann einfach mal am Handy eine (wahrscheinlich buggy) Funktion zum Überschreiben geschrieben.

Es geht an sich um die Funktion number_ex...wenn jemand sieht das es nicht funktioniert, würde ich ihn doch liebend gerne beten es zu fixen und hier im Thread zu posten, das wäre sehr nett ^-^


Naja hier habt ihr die Source:


ob es funktioniert weiß ich wie gesagt nicht, ich hoffe schon xD

MfG
TheMarv :< is offline  
Old 07/15/2013, 16:28   #2
 
elite*gold: 0
Join Date: Dec 2012
Posts: 64
Received Thanks: 17
work 100%
.Bloddy is offline  
Old 07/15/2013, 16:48   #3

 
elite*gold: 0
Join Date: Jan 2013
Posts: 348
Received Thanks: 353
Quote:
Originally Posted by .Bloddy View Post
work 100%
are you sure? are you really, really sure?
TheMarv :< is offline  
Old 07/15/2013, 17:04   #4
 
Mashkin's Avatar
 
elite*gold: 44
Join Date: May 2010
Posts: 2,053
Received Thanks: 1,747
Seems legit because you first need to tell the compiler what thecore_random points to (you cannot call functions by name without introducing their addresses).

The function is roughly the same - except that the error handling looks better to me.
The reference to sys_err is missing though.
Mashkin is offline  
Old 07/15/2013, 17:10   #5

 
elite*gold: 0
Join Date: Jan 2013
Posts: 348
Received Thanks: 353
Quote:
Originally Posted by Mashkin View Post
Seems legit because you first need to tell the compiler what thecore_random points to (you cannot call functions by name without introducing their addresses).

The function is roughly the same - except that the error handling looks better to me.
The reference to sys_err is missing though.
i knew i forgot something....could you tell me the address of the thecore_random function?
TheMarv :< is offline  
Old 07/15/2013, 17:42   #6

 
elite*gold: 0
Join Date: Mar 2013
Posts: 2,449
Received Thanks: 6,446
Ein Tpp:

Wenn bei einer if-Abfrage nur eine Zeile folgt, musst du die geschweiften Klammern nicht machen.
Das Gleiche auch bei Schleifen etc.

So zB:


Spart Zeit am Handy
Lord iRemix is offline  
Old 07/15/2013, 17:47   #7

 
iMer's Avatar
 
elite*gold: 606
Join Date: Apr 2008
Posts: 3,180
Received Thanks: 5,376
Quote:
Originally Posted by .Remix. View Post
Ein Tpp:

Wenn bei einer if-Abfrage nur eine Zeile folgt, musst du die geschweiften Klammern nicht machen.
Das Gleiche auch bei Schleifen etc.

So zB:


Spart Zeit am Handy
Sollte man aber trozdem machen, da es zur lesbarkeit beiträgt.
iMer is offline  
Thanks
2 Users
Old 07/15/2013, 18:41   #8

 
elite*gold: 0
Join Date: Jan 2013
Posts: 348
Received Thanks: 353
Quote:
Originally Posted by .Remix. View Post
Ein Tpp:

Wenn bei einer if-Abfrage nur eine Zeile folgt, musst du die geschweiften Klammern nicht machen.
Das Gleiche auch bei Schleifen etc.

So zB:


Spart Zeit am Handy
jo schon, aber ist nicht so meine Art :P
Ab und zu mach ich es, meistens vergesse ich es einfach xD
TheMarv :< is offline  
Old 07/15/2013, 18:47   #9
 
xCPx's Avatar
 
elite*gold: 20
Join Date: Jun 2011
Posts: 2,901
Received Thanks: 3,342
Wieso zur hölle schaut eig niemand danach, was fürn rückgabewert number_ex eigentlich hat?
Selbst die Lösung von Luca ist falsch, da er auch nicht drauf geachtet hat.
Hier mal meine Variante (kp ob gut, aber immerhin mitm richtigen Rückgabe-Wert)

in den header:
Code:
unsigned int (*number_ex)(int arg1, int arg2) = (unsigned int(*)(int,int))0x08439620;
int (*thecore_random)() = (int(*)())0x08439610;
in die main.cpp
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include <stdbool.h>
#include <dlfcn.h>
#include <sys/mman.h>
#include <inttypes.h>
#include "utils/ddetour.h"
#include "gamefunctions.h"


void __attribute__ ((constructor)) my_load(void);

unsigned int fix_number_ex(int a1, int a2)
{
	int temp;
	if(a1 <0)
	{
		a1 += -(a1*2);
	}
	if(a2 <0)
	{
		a2 += -(a2*2);
	}
	if(a1 > a2)
	{
		temp = a1;
		a1 = a2;
		a2 = temp;
	}
	temp = (a2 +1 - a1)
	if(temp <= 0)
	{
		temp = 1;
	}
	return a1 + thecore_random() % temp;
}

void my_load(void)
{
	srand(time(0));
	number_ex = (unsigned int (*)(int, int))detour((unsigned int*)0x08439620,(unsigned int *)fix_number_ex, DETOUR_LEN_AUTO, 0);
}
xCPx is offline  
Old 07/15/2013, 19:00   #10

 
elite*gold: 0
Join Date: Jan 2013
Posts: 348
Received Thanks: 353
Quote:
Originally Posted by xCPx View Post
Wieso zur hölle schaut eig niemand danach, was fürn rückgabewert number_ex eigentlich hat?
Selbst die Lösung von Luca ist falsch, da er auch nicht drauf geachtet hat.
Hier mal meine Variante (kp ob gut, aber immerhin mitm richtigen Rückgabe-Wert)

in den header:
Code:
unsigned int (*number_ex)(int arg1, int arg2) = (unsigned int(*)(int,int))0x08439620;
int (*thecore_random)() = (int(*)())0x08439610;
in die main.cpp
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>
#include <stdbool.h>
#include <dlfcn.h>
#include <sys/mman.h>
#include <inttypes.h>
#include "utils/ddetour.h"
#include "gamefunctions.h"


void __attribute__ ((constructor)) my_load(void);

unsigned int fix_number_ex(int a1, int a2)
{
	int temp;
	if(a1 <0)
	{
		a1 += -(a1*2);
	}
	if(a2 <0)
	{
		a2 += -(a2*2);
	}
	if(a1 > a2)
	{
		temp = a1;
		a1 = a2;
		a2 = temp;
	}
	temp = (a2 +1 - a1)
	if(temp <= 0)
	{
		temp = 1;
	}
	return a1 + thecore_random() % temp;
}

void my_load(void)
{
	srand(time(0));
	number_ex = (unsigned int (*)(int, int))detour((unsigned int*)0x08439620,(unsigned int *)fix_number_ex, DETOUR_LEN_AUTO, 0);
}
Und was wenn beide Werte gleich sind? :P
TheMarv :< is offline  
Old 07/15/2013, 19:15   #11
 
xCPx's Avatar
 
elite*gold: 20
Join Date: Jun 2011
Posts: 2,901
Received Thanks: 3,342
Quote:
Originally Posted by TheMarv :< View Post
Und was wenn beide Werte gleich sind? :P
Haste die exception doch drin:
temp = (a2 +1 - a1)


Wenn beide gleich sind ergibt das 1

Und sollte doch 0 rauskommen, so ist es danach durch:
if(temp <= 0)
{
temp = 1;
}
Wd 1

also von daher sollte das alles gefixxt sein.
xCPx is offline  
Old 07/15/2013, 19:45   #12

 
elite*gold: 0
Join Date: Jan 2013
Posts: 348
Received Thanks: 353
Quote:
Originally Posted by xCPx View Post
Haste die exception doch drin:
temp = (a2 +1 - a1)


Wenn beide gleich sind ergibt das 1

Und sollte doch 0 rauskommen, so ist es danach durch:
if(temp <= 0)
{
temp = 1;
}
Wd 1

also von daher sollte das alles gefixxt sein.
achso ja, hatte nur drüber geschaut gehabt xD
naja aber was solls, es werden sowieso ein großteil der server nicht einbauen :P
TheMarv :< is offline  
Old 07/15/2013, 20:11   #13

 
elite*gold: 0
Join Date: Feb 2008
Posts: 2,754
Received Thanks: 1,748
Gut, dass es uns ohne die ddetour.h was nützt.
Computerfreek is offline  
Old 07/15/2013, 20:14   #14

 
elite*gold: 0
Join Date: Jan 2013
Posts: 348
Received Thanks: 353
Quote:
Originally Posted by Computerfreek View Post
Gut, dass es uns ohne die ddetour.h was nützt.
die gibts beim thread wie man .so extensions macht mit dabei....
TheMarv :< is offline  
Old 07/15/2013, 23:24   #15
 
Mi4uric3's Avatar
 
elite*gold: 405
Join Date: Dec 2007
Posts: 6,615
Received Thanks: 6,358
Quote:
Originally Posted by Computerfreek View Post
Gut, dass es uns ohne die ddetour.h was nützt.
Eine Detour-Funktion zu schreiben ist nicht sonderlich kompliziert..

Pseudocode
Code:
void detour(void* src, void* dest) {
	mprotect von src mit size 5
	unsigned char array mit größe 5 erstellen
	array[0] = E9
	array[1] = dest - src - 5
	memcpy von array nach src mit der länge 5
}
Mi4uric3 is offline  
Thanks
2 Users
Reply


Similar Threads Similar Threads
[RELEASE] Dice Game script (event)
08/02/2011 - EO PServer Guides & Releases - 3 Replies
Hi all, this is a simple event i made for you... you have to add the npc yourself, but however here is the script! what is this dice game? Well, it is gambling..... but on EO :)
[RELEASE] NAGC BOARD GAME - INFINITE DICE
12/13/2010 - Grand Chase Hacks, Bots, Cheats & Exploits - 94 Replies
Finally right? Took along time to get this working, so here it is, This hack freezes the value of your dice to 1, if you have more than one die, it will go down to 1, and stay at 1. How to use: 1: Download BoardFreezer and extract it with winRAR 2: Run GC_Board_Freezer_32bit (The shortcut) 3: There will be an error message, Just press OK 4: Log into your account. Welcome To Grandchase!
[Release] [Untested] Awarding Halos
12/06/2009 - CO2 PServer Guides & Releases - 4 Replies
Im not entirely sure this works but its an idea. Someone try this out or tell me whats wrong please. Chat.cs if (Cmd == "/awardtopWarrior") #region Players try { foreach (Game.Character Player in Game.World.H_Chars.Values) #endregion ...
[Release]Ugly Blue Release
08/30/2009 - CO2 PServer Guides & Releases - 8 Replies
This is another of my websites release Open Index with notepad The Search For 24.91.136.230 And replace it with your IP adress thats the server stats checker to see if your server is online or no, http://img502.imageshack.us/img502/9318/uglyblue. jpg Please Do not flame this was just a quick website, Below



All times are GMT +1. The time now is 17:18.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.