Pages

luni, 12 august 2024

News : Millennia: Ancient Worlds | Release Trailer

News : FencerDevLog - Godot 4: Screen glitch shader (tutorial) .

... more video tutorials from FencerDevLog - official youtube channel .

FASM : play a wav file with assembly programming language.

... this source code in FASM will play a hexa file using a window with two buttons, see my comments to deal with 'how to do it' ... :
; sound player example , tested with tada.wav from windows os
; convert wav file with
; tomeko.net/online_tools/file_to_hex.php online tool
; to text from tool , then add 'db ' in the front of Sound.inc text file like this:
; db 0x52, 0x49, 0x46, 0x46,
; this : 0x52, 0x49, 0x46, 0x46, is header for RIFF WAV file format

format PE GUI 4.0
entry start

include 'INCLUDE\win32a.inc'

ID_CAPTION         = 101
ID_MESSAGE         = 102
ID_ICONERROR       = 201
ID_ICONINFORMATION = 202
ID_ICONQUESTION    = 203
ID_ICONWARNING     = 204
ID_TOPMOST         = 301

section '.text' code readable executable

  start:

        invoke  GetModuleHandle,0
        invoke  DialogBoxParam,eax,37,HWND_DESKTOP,DialogProc,0
        invoke ExitProcess,0

proc DialogProc hwnddlg,msg,wparam,lparam
        push    ebx esi edi
        cmp     [msg],WM_INITDIALOG
        je      .wminitdialog
        cmp     [msg],WM_COMMAND
        je      .wmcommand
        cmp     [msg],WM_CLOSE
        je      .wmclose
        xor     eax,eax
        jmp     .finish
  .wminitdialog:

        jmp     .processed
  .wmcommand:
        cmp     [wparam],BN_CLICKED shl 16 + IDCANCEL    ; stop
        je      .player_stop

        cmp     [wparam],BN_CLICKED shl 16 + IDOK
        je      .player_play

        jmp     .processed

  .player_stop:
        invoke play, NULL, NULL, NULL     ; stop
        jmp     .processed

  .player_play:
        invoke play, sndFile, NULL, 0x0004 or 0x0001 ; 0x0004 = SND_MEMORY + ASYNC = 0x0001
        jmp     .processed

  .wmclose:
        invoke  EndDialog,[hwnddlg],0

  .processed:
        mov     eax,1
  .finish:
        pop     edi esi ebx
        ret
endp

section '.bss' readable writeable

  sndFile :
           ;db 'Sound.wav',0
  include 'Sound.inc';
section '.idata' import data readable writeable

  library kernel,'KERNEL32.DLL',\
          user,'USER32.DLL',\
          winmm,'winmm.dll'

  import winmm,\
          play, 'PlaySound'

  import kernel,\
         GetModuleHandle,'GetModuleHandleA',\
         ExitProcess,'ExitProcess'

  import user,\
         DialogBoxParam,'DialogBoxParamA',\
         EndDialog,'EndDialog'

section '.rsrc' resource data readable

  directory RT_DIALOG,dialogs

  resource dialogs,\
           37,LANG_ENGLISH+SUBLANG_DEFAULT,demonstration

  dialog demonstration,'SoundPlayer / _ (typedef)',70,76,110,30,WS_CAPTION+WS_POPUP+WS_SYSMENU+DS_MODALFRAME
    dialogitem 'BUTTON','Play',IDOK,10,10,45,15,WS_VISIBLE
    dialogitem 'BUTTON','Stop',IDCANCEL,54,10,45,15,WS_VISIBLE
  enddialog

sâmbătă, 10 august 2024

FASM : take a screenshot with assembly programming language.

From my old assembly projects, this is a source code that take an screenshot of your display.
format PE GUI 4.0

include 'INCLUDE\win32w.inc'

struct GdiplusStartupInput
  GdiplusVersion	   dd ?
  DebugEventCallback	   dd ?
  SuppressBackgroundThread dd ?
  SuppressExternalCodecs   dd ?
ends

struct ImageCodecInfo
  Clsid 	    db 16 dup ?
  FormatID	    db 16 dup ?
  CodecName	    dd ?
  DllName	    dd ?
  FormatDescription dd ?
  FilenameExtension dd ?
  MimeType	    dd ?
  Flags 	    dd ?
  Version	    dd ?
  SigCount	    dd ?
  SizeSize	    dd ?
  SigPattern	    dd ?
  SigMask	    dd ?
ends

section '.text' code readable executable

entry $

	invoke	GdiplusStartup,token,input,NULL
	test	eax,eax
	jnz	exit

	invoke	GdipGetImageEncodersSize,encoders_count,encoders_size
	test	eax,eax
	jnz	gdiplus_shutdown
	invoke	VirtualAlloc,0,[encoders_size],MEM_COMMIT,PAGE_READWRITE
	test	eax,eax
	jz	gdiplus_shutdown
	mov	ebx,eax
	invoke	GdipGetImageEncoders,[encoders_count],[encoders_size],ebx
	test	eax,eax
	jnz	gdiplus_shutdown
    scan_encoders:
	mov	esi,[ebx+ImageCodecInfo.MimeType]
	mov	edi,encoder_mimetype
	mov	ecx,(encoder_clsid-encoder_mimetype) shr 1
	repe	cmpsw
	je	encoder_found
	add	ebx,sizeof.ImageCodecInfo
	dec	[encoders_count]
	jnz	scan_encoders
	; no encoder found
	jmp	gdiplus_shutdown
     encoder_found:
	lea	esi,[ebx+ImageCodecInfo.Clsid]
	mov	edi,encoder_clsid
	mov	ecx,4
	rep	movsd
	invoke	VirtualFree,ebx,0,MEM_RELEASE

	invoke	GetDC,HWND_DESKTOP
	test	eax,eax
	jz	gdiplus_shutdown
	mov	esi,eax
	invoke	GetSystemMetrics,SM_CYSCREEN
	mov	[screen_height],eax
	invoke	GetSystemMetrics,SM_CXSCREEN
	mov	[screen_width],eax
	invoke	CreateCompatibleBitmap,esi,[screen_width],[screen_height]
	test	eax,eax
	jz	release_desktop_dc
	mov	ebx,eax
	invoke	CreateCompatibleDC,esi
	test	eax,eax
	jz	delete_bitmap
	mov	edi,eax
	invoke	SelectObject,edi,ebx
	test	eax,eax
	jz	delete_dc
	invoke	BitBlt,edi,0,0,[screen_width],[screen_height],esi,0,0,SRCCOPY
	test	eax,eax
	jz	delete_dc

	invoke	GdipCreateBitmapFromHBITMAP,ebx,NULL,gdip_bitmap
	test	eax,eax
	jnz	delete_dc

	invoke	GdipSaveImageToFile,[gdip_bitmap],file_name,encoder_clsid,NULL

	invoke	GdipDisposeImage,[gdip_bitmap]
  delete_dc:
	invoke	DeleteObject,edi
  delete_bitmap:
	invoke	DeleteObject,ebx
  release_desktop_dc:
	invoke	ReleaseDC,HWND_DESKTOP,esi
  gdiplus_shutdown:
	invoke	GdiplusShutdown,[token]
  exit:
	invoke	ExitProcess,0


section '.data' data readable writeable

  file_name du 'test.jpg',0

  encoder_mimetype du 'image/jpeg',0
	   .length = $ - encoder_mimetype
  encoder_clsid db 16 dup ?

  input GdiplusStartupInput 1
  token dd ?
  memdc dd ?
  gdip_bitmap dd ?

  encoders_count dd ?
  encoders_size dd ?

  screen_width dd ?
  screen_height dd ?

section '.rdata' data readable

data import

  library kernel32,'KERNEL32.DLL',\
	  user32,'USER32.DLL',\
	  gdi32,'GDI32.DLL',\
	  gdiplus, 'GDIPLUS.DLL'

  include 'INCLUDE\API\kernel32.inc'
  include 'INCLUDE\API\user32.inc'
  include 'INCLUDE\API\gdi32.inc'

  import  gdiplus,\
	  GdiplusStartup,'GdiplusStartup',\
	  GdiplusShutdown,'GdiplusShutdown',\
	  GdipGetImageEncodersSize,'GdipGetImageEncodersSize',\
	  GdipGetImageEncoders,'GdipGetImageEncoders',\
	  GdipSaveImageToFile,'GdipSaveImageToFile',\
	  GdipDisposeImage,'GdipDisposeImage',\
	  GdipCreateBitmapFromHBITMAP,'GdipCreateBitmapFromHBITMAP'

end data

duminică, 4 august 2024

FASM : writing on the screen with assembly programming language.

I haven't worked in assembly language for a long time. My favorite is FASM.
Here is an example of older source code that randomly displays some colored pixels.
If you change this line of source code, you will see that it is written directly on the screen from Windows 10:
invoke FindWindow,NULL,<'Random Pixels Screen'>
this is the result:
... using this you cannot be able to take a screenshot with Windows shortkeys:
invoke FindWindow,NULL,<'Random Pixels ...'>
This is the source code, if you want to test it:
format pe console
entry start

include 'INCLUDE/WIN32AX.INC'

section '.code' code readable writeable executable 

start:   
     invoke GetStdHandle,STD_OUTPUT_HANDLE
     mov [stdout],eax
          
     mov [rect.Left],0
     mov [rect.Top],0
     mov [rect.Right],79
     mov [rect.Bottom],44
     mov [coord.x],8
     mov [coord.y],40
     mov [cinfo.dwSize],25
     mov [cinfo.bVisible],FALSE
     
     cinvoke system,<'cls'>
     cinvoke srand,<cinvoke time,NULL>
     invoke SetConsoleTitle,<'Random Pixels Screen'>
     invoke SetConsoleWindowInfo,[stdout],1,rect
     invoke SetConsoleScreenBufferSize,[stdout],dword[coord]   
     invoke SetConsoleCursorInfo,[stdout],cinfo
     
     invoke FindWindow,NULL,<'Random Pixels ...'>
     mov [hWnd],eax
     invoke GetDC,[hWnd]
     mov [hdc],eax
                                     
@@:   
     cinvoke rand
     shl eax,9
     push eax
     cinvoke rand
     pop ecx
     add eax,ecx
     mov esi,eax
     invoke SetPixel,[hdc],<stdcall rnd,640>,<stdcall rnd,100>,esi
     cinvoke _kbhit
     test eax,eax
     jz @b
     invoke ExitProcess,0

proc rnd max
     cinvoke rand 
     shl eax,17
     mul [max]
     mov eax,edx            
     ret
endp    

section '.data' data readable writeable

struc COORD {
     .x dw ?
     .y dw ?
    } 

struc SMALL_RECT {
     .Left dw ?
     .Top dw ?
     .Right dw ?
     .Bottom dw ?
    } 

struc LPCONSOLE_CURSOR_INFO {
     .dwSize dd ?
     .bVisible db ?
    }      
     
     cinfo LPCONSOLE_CURSOR_INFO
     rect SMALL_RECT
     coord COORD     
          
     stdout dd ?
     hWnd dd ?
     hdc dd ?

     
section '.idata' import data readable writeable

     library kernel32,'kernel32.dll',\
        msvcrt,'msvcrt.dll',\
        user32,'user32.dll',\
        gdi32,'gdi32.dll'
         
     import gdi32,\
        SetPixel,'SetPixel'
                  
     import user32,\
        GetDC,'GetDC',\
        FindWindow,'FindWindowA'
             
     import kernel32,\     
        ExitProcess,'ExitProcess',\
        GetStdHandle,'GetStdHandle',\
        SetConsoleTitle,'SetConsoleTitleA',\
        SetConsoleCursorInfo,'SetConsoleCursorInfo',\
        SetConsoleWindowInfo,'SetConsoleWindowInfo',\
        SetConsoleCursorPosition,'SetConsoleCursorPosition',\
        SetConsoleScreenBufferSize,'SetConsoleScreenBufferSize'   
            
     import msvcrt,\
        _kbhit,'_kbhit',\
        system,'system',\      
        srand,'srand',\
        rand,'rand',\
        time,'time'

News : Inkscape Is About To Revolutionize The Shape Builder | v1.4 Beta Update

Inkscape : Create an extension for inkscape.

You can create your own extensions in inkscape with all features you need to improve the working area.
One extension can have minimum two file: the basic Python source code and another file with the graphic user interface ...
The source code of Python file can be link with the G.U.I. source code type file INX.
The source code for python can be customized and this is the main reason is no need to add it here.
Let's see the source code for the INX file:
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
    <name>Default extension example</name>
    <id>default.extensions.example</id>
    <param name="tab" type="notebook">
        <page name="Options" gui-text="Options">
            <param name="value_int" type="int" min="0" max="9" gui-text="INT type value from 0 up to 9 : ">10</param>
            <param name="value_bool" type="bool" gui-text="BOOL value set to false : ">false</param>
            <param name="value_space" type="float" gui-text="FLOAT value set to 0.1 custom range min 0.0 up max=99.0 : " min="0.0" max="99.0">0.1</param>
                <param name="option_group selection" type="optiongroup" appearance="combo" gui-text="Options :">
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
            </param>
		<param name="grouppick" type="bool" gui-text="selection pick ..." gui-description="This is gui-description">false</param>
            <param name="pickmode" type="optiongroup" appearance="combo" gui-text="pick values group:">
                <option value="first">first</option>
                <option value="second">second</option>
            </param> 
	</page>
        <page name="Help" gui-text="Help for default extension example">
            <label xml:space="preserve">This is example of default extension example
	You can use this INX file and PY files type named 'default_extension_example'</label>
        </page>
    </param>
    <effect>
        <object-type>all</object-type>
        <effects-menu>
            <submenu name="catafest"/>
        </effects-menu>
    </effect>
    <script>
        <command location="inx" interpreter="python">default_extension_example.py</command>
    </script>
</inkscape-extension>
Bellow you can see some screenshots with these result

sâmbătă, 3 august 2024

News : Quick Gaea 2.0 to Blender Workflow

Gaea 2.0 is now available for everyone!
Gaea 2.0, one of the best tools for generating landscapes quickly, is finally out! And that means it's time for a introductory tutorial. In today's video I will introduce you to this tool, its erosion, masking and texturing tools - and at the end, we'll export everything to Blender.
You can download this software from the official website.
See this video tutorial about how can be used with Blender 3D software, from Martin Klekner - youtube channel.

vineri, 2 august 2024

News : Opening Night Live Teaser | Gamescom | Predecessor

Predecessor redefines the modern MOBA genre, blending stunning realistic environments with explosive third-person action.

News : Teamfight Tactics - free on Epic Games.

... now is free on Epic Games :
Magic n' Mayhem is Teamfight Tactic's 12th set and it brings with it a jam-packed series of changes including charms, new unique champions to TFT like Norra ...