I'm making this for people that may have the same problems as me when they start making their servers. These may be permanent or temporary fixes but they all work for me so far.
My first problem I ran into was setting up the source I would keep getting this error:
in this section of coding:
elite50 helped me fix this.
1. To fix it you have too run Navicat off of Appserv, I was running mine off the mysql server before.
2. You must have the database loaded in Navicat.
3. If running on a 64x computer must convert to 32 bit (86x).
4. This might not be the problem for everyone but I cannot log in to my server from debugging the source from C#, I must go to the source folder > bin > 86x > debug and run it from there.
**Use this for Native.cs it worked for me **
That's all I know about that problem.
--------------------------------------------------------------------------
The next problem I ran into was when I created a character he/she would start with a random number of rebirths. I fixed this by going to database.cs and adding a catch to the loading character.
Find this line:
At the bottom of that LoadCharacter section there is this:
You want to add "C.Reborns = 0;"
Find this line:
At the bottom of that LoadAsRobot section there is this:
You want to add "C.Reborns = 0;"
--------------------------------------------------------------------------
The reborn fix may just be temporary I'm not sure yet. That's all I got for now if I come up with anything else ill post it here
My first problem I ran into was setting up the source I would keep getting this error:
Code:
PInvokeStackImbalance was detected Message: A call to PInvoke function 'NewestCOServer!NewestCOServer.Native::memcpy' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
Code:
unsafe void WaitData(IAsyncResult Res)
{
try
{
StateObj S = (StateObj)Res.AsyncState;
SocketError SE;
try
{
if (S.Sock.Connected)
{
uint DataLen = (uint)S.Sock.EndReceive(Res, out SE);
if (SE == SocketError.Success && DataLen != 0)
{
byte[] RData = new byte[DataLen];
fixed (byte* p = RData, p2 = S.Data)
[COLOR="Red"]Native.memcpy(p, p2, DataLen);[/COLOR]
if (DataHandler != null)
DataHandler.Invoke(S, RData);
S.Sock.BeginReceive(S.Data, 0, 1024, SocketFlags.None, new AsyncCallback(WaitData), S);
}
else if (DCHandler != null)
DCHandler.Invoke(S);
}
else if (DCHandler != null)
DCHandler.Invoke(S);
}
catch
{
if (DCHandler != null)
DCHandler.Invoke(S);
}
}
catch (Exception Exc) { Program.WriteLine(Exc); }
}
1. To fix it you have too run Navicat off of Appserv, I was running mine off the mysql server before.
2. You must have the database loaded in Navicat.
3. If running on a 64x computer must convert to 32 bit (86x).
4. This might not be the problem for everyone but I cannot log in to my server from debugging the source from C#, I must go to the source folder > bin > 86x > debug and run it from there.
**Use this for Native.cs it worked for me **
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace NewestCOServer
{
public unsafe class Native
{
[DllImport("kernel32.dll")]
public static extern IntPtr GetStdHandle(uint nStdHandle);
[DllImport("kernel32.dll")]
public static extern bool SetConsoleTextAttribute(IntPtr hConsoleOutput, int wAttributes);
[DllImport("msvcrt.dll", EntryPoint = "memcpy", CallingConvention = CallingConvention.Cdecl, SetLastError = false)]
public static extern unsafe void* memcpy(void* dest, void* src, uint size);
[DllImport("user32.dll")]
public static extern int MessageBox(int h, string m, string c, int type);
[DllImport("winmm.dll")]
public static extern uint timeGetTime();
[DllImport("libeay32.dll", CallingConvention = CallingConvention.Cdecl)]
public extern static void BF_set_key(IntPtr _key, int len, byte[] data);
[DllImport("libeay32.dll", CallingConvention = CallingConvention.Cdecl)]
public extern static void BF_ecb_encrypt(byte[] in_, byte[] out_, IntPtr schedule, int enc);
[DllImport("libeay32.dll", CallingConvention = CallingConvention.Cdecl)]
public extern static void BF_cbc_encrypt(byte[] in_, byte[] out_, int length, IntPtr schedule, byte[] ivec, int enc);
[DllImport("libeay32.dll", CallingConvention = CallingConvention.Cdecl)]
public extern static void BF_cfb64_encrypt(byte[] in_, byte[] out_, int length, IntPtr schedule, byte[] ivec, ref int num, int enc);
[DllImport("libeay32.dll", CallingConvention = CallingConvention.Cdecl)]
public extern static void BF_ofb64_encrypt(byte[] in_, byte[] out_, int length, IntPtr schedule, byte[] ivec, out int num);
}
}
--------------------------------------------------------------------------
The next problem I ran into was when I created a character he/she would start with a random number of rebirths. I fixed this by going to database.cs and adding a catch to the loading character.
Find this line:
Code:
public static Game.Character LoadCharacter(string Name, ref string Account)
Code:
catch
{
C.VipLevel = 0;
C.ExpBallsUsedToday = 0;
C.LotteryUsed = 0;
C.TrainTimeLeft = 0;
C.InOTG = false;
C.LotteryUsed = 0;
C.WHPassword = "0";
C.Spouse = "None";
C.UniversityPoints = 0;
}
Find this line:
Code:
public static Game.Robot LoadAsRobot(string Name, ref string Account)
Code:
catch
{
C.VipLevel = 0;
C.ExpBallsUsedToday = 0;
C.LotteryUsed = 0;
C.Reborns = 0;
C.TrainTimeLeft = 0;
C.InOTG = false;
C.LotteryUsed = 0;
C.WHPassword = "0";
C.Spouse = "None";
}
--------------------------------------------------------------------------
The reborn fix may just be temporary I'm not sure yet. That's all I got for now if I come up with anything else ill post it here