Register | Login
Forum Index > Source Help > do not know where is the bug
Author Message
Pages: 1 2 3 4
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1096] - posted: 2012-05-13 20:41:37
sounds like strlcpy is not writing the null char

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1097] - posted: 2012-05-13 22:28:15

ok here is an other problem.

this function was inline and every thing is okay , but when i change it to be a real function
that return Dx9 interface ,the program crash.

Code:
function InitDx9(Dword Wnd,Width,Height)
{

   D3DPRESENT_PARAMETERS presParams;
   IDirect3DDevice9 dx_device;
   
   m_strFill(@presParams, sizeof presParams, 0);
   presParams.hDeviceWindow          = Wnd;
   presParams.Windowed               = True;
   presParams.BackBufferWidth        = Width;
   presParams.BackBufferHeight       = Height;
   presParams.BackBufferCount        = 1;
   presParams.BackBufferFormat       = D3DFMT_A8R8G8B8;
   presParams.SwapEffect             = D3DSWAPEFFECT_FLIP;
   presParams.AutoDepthStencilFormat = D3DFMT_D16;
   presParams.EnableAutoDepthStencil = True;

   IDirect3D9 dx_object = Direct3DCreate9(D3D_SDK_VERSION);
   
   Edi = dx_object as IDirect3D9;
   Eax = Edi.CreateDevice(0, D3DDEVTYPE_HAL, Wnd, 64, @presParams, @dx_device);
   return dx_device;
}


does i made something wrong?

http://www.freewebs.com/ogremagic/index.htm
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1098] - posted: 2012-05-13 23:01:29

with some investigation , found that , this line cause the crash.
Code:
Eax = Edi.CreateDevice(0, D3DDEVTYPE_HAL, Wnd, 64, @presParams, @dx_device);


http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1099] - posted: 2012-05-14 16:34:35
first problem i see is as a function you use edi but don't protect it... add uses clause at top

Code:
uses edi;


meanwhile i will find what is the other problem

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1100] - posted: 2012-05-14 19:19:39

ok , it still crash after protect Edi.


http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1105] - posted: 2012-05-15 00:48:32
I have just updated the beta download which addresses this issue, actually there is a big problem with my internal handler for classes/interfaces, i will hopefully get round to doing a whole rewrite of the assembler core over the next months, if i do, the whole backend should be much more stable and have much quicker fixes.

anyways the code i used to test with is based on the directx9 sample:

Code:
program WIN32GUI 'DX9Sample';

#include 'user32.zir';
#include 'kernel32.zir';
#include 'messages.zir';
#include 'colors.zir';

#include 'ch.zir';

#include 'directx/direct3d9.zir';

//////////////////////////////


//other variables
tagWndClassA wndClass;
tagMsg msg;
DWord hInstance = GetModuleHandleA(nil);
//

//handles
DWord hMainFRM;
//

//////////////////////////////


function WindowProc(DWord hWnd; DWord uMsg; DWord wParam; DWord lParam) {
  if (uMsg == WM_COMMAND) {  
    eax = DefWindowProcA(hWnd, uMsg, wParam, lParam);
    ret
  } elseif (uMsg == WM_DESTROY) {
    PostQuitMessage(0);
  } else {
    eax = DefWindowProcA(hWnd, uMsg, wParam, lParam);
  }
}


const className = 'ZMainFRM';

wndClass.hbrBackground = COLOR_BACKGROUND;
wndClass.hInstance = hInstance;
wndClass.lpszClassName = className;
wndClass.lpfnWndProc = @WindowProc;  

RegisterClassA(@wndClass);
hMainFRM = CreateWindowExA(0, className, 'Ziron DirectX9 Demo', WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 1024, 768, 0, 0, hInstance, nil);
ShowWindow(hMainFRM, SW_SHOWNORMAL);


function InitDx9(Dword Wnd,Width,Height) {
  uses edi;

  D3DPRESENT_PARAMETERS presParams;
  IDirect3DDevice9 dx_device;
   
  m_strFill(@presParams, sizeof presParams, 0);
  presParams.hDeviceWindow          = Wnd;
  presParams.Windowed               = True;
  presParams.BackBufferWidth        = Width;
  presParams.BackBufferHeight       = Height;
  presParams.BackBufferCount        = 1;
  presParams.BackBufferFormat       = D3DFMT_A8R8G8B8;
  presParams.SwapEffect             = D3DSWAPEFFECT_DISCARD;
  presParams.AutoDepthStencilFormat = D3DFMT_D24X8;
  presParams.EnableAutoDepthStencil = True;

  IDirect3D9 dx_object = Direct3DCreate9(D3D_SDK_VERSION);
   
  Edi = dx_object as IDirect3D9;
  Eax = Edi.CreateDevice(0, D3DDEVTYPE_HAL, Wnd, 64, @presParams, @dx_device);
  
  return dx_device;
}


edi = InitDx9(hMainFRM, 1024, 768) as IDirect3DDevice9;

// Set up message loop
while (eax <> WM_QUIT) { 
  edi.clear(0, nil, 3, 0xFF0000FF, 1.0, 0);
  edi.BeginScene;
  //
  
  //render something here :)
  
  //
  edi.EndScene;
  edi.Present(nil, nil, 0, nil);
  
  eax = PeekMessage(@msg, 0, 0, 0, 1);
  if (eax) {
    TranslateMessage(@msg);
    DispatchMessageA(@msg);

    eax = msg.message;
  }  
}

ExitProcess(0);


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1107] - posted: 2012-05-15 19:13:13

ok it works fine now.

BTW i have just discovered a bug in plugin statement.

Code:
plugin off

program WIN32CUI 'Sprite';

#include 'user32.zir';
#include 'kernel32.zir';
#include 'messages.zir';


this was a part of my code , as you see the first line forces ziron to load no pluging at all
but when compile i found my plugin loaded and manipulate the code.!!!!!!!!!

http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1109] - posted: 2012-05-15 20:56:16
Code:
plugins off;


you are trying to load a non-existant plugin "off"

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1 2 3 4
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 2 user(s) online. 0 member(s) and 2 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd