vcbfm

Mesen Lua API reference_Mesen Lua 函数库

Oct 25th, 2024 (edited)
1,417
0
Never
10
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.49 KB | None | 0 0
  1. --Mesen Lua 函数库.
  2. Mesen Lua API reference
  3.  
  4. Important: This API is similar but not completely compatible with the old Mesen 0.9.x (or Mesen-S) Lua APIs.
  5.  
  6. Generated on Sep 6 2024, 08:54:50 for Mesen 2.0.0.
  7. Callbacks
  8. addEventCallback
  9.  
  10. Syntax
  11. emu.addEventCallback(callback, eventType)
  12.  
  13. Parameters
  14. callback - Function
  15. Lua function to call when the event occurs
  16. eventType - Enum (eventType)
  17. Event type
  18.  
  19. Return value
  20. Int - Value that can be used to remove the callback by calling emu.removeEventCallback().
  21.  
  22. Description
  23. Registers a callback function to be called whenever the specified event occurs.
  24. The callback function receives 1 parameter ("cpuType") which is an enum value (emu.cpuType) which indicates which CPU triggered the event (useful to distinguish between identical events triggered by different CPUs, e.g Super Game Boy).
  25. addMemoryCallback
  26.  
  27. Syntax
  28. emu.addMemoryCallback(callback, callbackType, startAddress, endAddress, cpuType, memoryType)
  29.  
  30. Parameters
  31. callback - Function
  32. Lua function to call when the event occurs
  33. callbackType - Enum (callbackType)
  34. Callback type
  35. startAddress - Int
  36. Start of the address range
  37. endAddress - Int (default: start address)
  38. End of the address range
  39. cpuType - Enum (cpuType) (default: main CPU)
  40. CPU used for the callback
  41. memoryType - Enum (memType) (default: main CPU memory)
  42. Memory type for the callback
  43.  
  44. Return value
  45. Int - Value that can be used to remove the callback by calling emu.removeMemoryCallback().
  46.  
  47. Description
  48. Registers a callback function to be called whenever the specified event occurs.
  49. The callback function receives 2 parameters ("address" and "value") that correspond to the address being written to or read from, and the value that is being read/written.
  50.  
  51. For reads, the callback is called after the read is performed.
  52. For writes, the callback is called before the write is performed.
  53.  
  54. If the callback returns an integer value, it will replace the value - you can alter the results of read/write operation by using this.
  55. removeEventCallback
  56.  
  57. Syntax
  58. emu.removeEventCallback(reference, eventType)
  59.  
  60. Parameters
  61. reference - Int
  62. Value returned by the call to emu.addEventCallback()
  63. eventType - Enum (eventType)
  64. Event type
  65.  
  66. Return value
  67. <none>
  68.  
  69. Description
  70. Removes a previously registered callback function.
  71. removeMemoryCallback
  72.  
  73. Syntax
  74. emu.removeMemoryCallback(reference, callbackType, startAddress, endAddress, cpuType, memoryType)
  75.  
  76. Parameters
  77. reference - Int
  78. Value returned by the call to emu.addMemoryCallback()
  79. callbackType - Enum (callbackType)
  80. Callback type
  81. startAddress - Int
  82. Start of the address range
  83. endAddress - Int (default: start address)
  84. End of the address range
  85. cpuType - Enum (cpuType) (default: main CPU)
  86. CPU used for the callback
  87. memoryType - Enum (memType) (default: main CPU memory)
  88. Memory type
  89.  
  90. Return value
  91. <none>
  92.  
  93. Description
  94. Removes a previously registered callback function.
  95. Drawing
  96. clearScreen
  97.  
  98. Syntax
  99. emu.clearScreen()
  100.  
  101. Parameters
  102. <none>
  103.  
  104. Return value
  105. <none>
  106.  
  107. Description
  108. Removes all drawn shapes from the screen.
  109. drawLine
  110.  
  111. Syntax
  112. emu.drawLine(x, y, x2, y2, color, duration, delay)
  113.  
  114. Parameters
  115. x - Int
  116. X position (start of line)
  117. y - Int
  118. Y position (start of line)
  119. x2 - Int
  120. X position (end of line)
  121. y2 - Int
  122. Y position (end of line)
  123. color - Int (ARGB) (default: 0xFFFFFF (white))
  124. Color
  125. duration - Int (default: 1)
  126. Number of frames to display
  127. delay - Int (default: 0)
  128. Number of frames to wait before drawing the line
  129.  
  130. Return value
  131. <none>
  132.  
  133. Description
  134. Draws a line between (x, y) to (x2, y2) using the specified color for a specific number of frames.
  135. drawPixel
  136.  
  137. Syntax
  138. emu.drawPixel(x, y, color, duration, delay)
  139.  
  140. Parameters
  141. x - Int
  142. X position
  143. y - Int
  144. Y position
  145. color - Int (ARGB)
  146. Color
  147. duration - Int (default: 1)
  148. Number of frames to display
  149. delay - Int (default: 0)
  150. Number of frames to wait before drawing the pixel
  151.  
  152. Return value
  153. <none>
  154.  
  155. Description
  156. Draws a pixel at the specified (x, y) coordinates using the specified color for a specific number of frames.
  157. drawRectangle
  158.  
  159. Syntax
  160. emu.drawRectangle(x, y, width, height, color, fill, duration, delay)
  161.  
  162. Parameters
  163. x - Int
  164. X position
  165. y - Int
  166. Y position
  167. width - Int
  168. Width
  169. height - Int
  170. Height
  171. color - Int (ARGB) (default: 0xFFFFFF (white))
  172. Color
  173. fill - Boolean (default: false)
  174. Whether or not to draw an outline, or a filled rectangle.
  175. duration - Int (default: 1)
  176. Number of frames to display
  177. delay - Int (default: 0)
  178. Number of frames to wait before drawing the rectangle
  179. 重试
  180.  
  181. 错误原因
  182.  
  183. Return value
  184. <none>
  185.  
  186. Description
  187. Draws a rectangle between (x, y) to (x+width, y+height) using the specified color for a specific number of frames. If fill is false, only the rectangle's outline will be drawn.
  188. drawString
  189.  
  190. Syntax
  191. emu.drawString(x, y, text, textColor, backgroundColor, maxWidth, duration, delay)
  192.  
  193. Parameters
  194. x - Int
  195. X position
  196. y - Int
  197. Y position
  198. text - String
  199. Text to display
  200. textColor - Int (ARGB) (default: 0xFFFFFF (white))
  201. Color to use for the text
  202. backgroundColor - Int (ARGB) (default: 0 (transparent))
  203. Color to use for the background
  204. maxWidth - Int (default: 0)
  205. 重试
  206.  
  207. 错误原因
  208. Max width (pixels) - wraps to next line when reached
  209. duration - Int (default: 1)
  210. Number of frames to display
  211. delay - Int (default: 0)
  212. Number of frames to wait before drawing the text
  213.  
  214. Return value
  215. <none>
  216.  
  217. Description
  218. Draws text at (x, y) using the specified text and colors for a specific number of frames.
  219. getDrawSurfaceSize
  220.  
  221. Syntax
  222. emu.getDrawSurfaceSize(surface)
  223.  
  224. Parameters
  225. surface - Enum (drawSurface) (default: current draw surface)
  226. Draw surface
  227.  
  228. Return value
  229. Table - { width = int, height = int, visibleWidth = int, visibleHeight = int, overscan = { top = int, bottom = int, left = int, right = int } }
  230.  
  231. Description
  232. Returns a table containing the full size, visible size and overscan size for the selected draw surface.
  233. 重试
  234.  
  235. 错误原因
  236. getPixel
  237.  
  238. Syntax
  239. emu.getPixel(x, y)
  240.  
  241. Parameters
  242. x - Int
  243. 重试
  244.  
  245. 错误原因
  246. X position
  247. y - Int
  248. Y position
  249.  
  250. Return value
  251. Int - ARGB color
  252.  
  253. Description
  254. Returns the color (in ARGB format) of the screen's output for the specified coordinates.
  255. getScreenBuffer
  256.  
  257. Syntax
  258. emu.getScreenBuffer()
  259.  
  260. Parameters
  261. <none>
  262.  
  263. Return value
  264. Array - Array of ARGB values
  265.  
  266. Description
  267. Returns an array of ARGB values with the contents of the console's screen - can be used with emu.setScreenBuffer() to modify the screen's contents.
  268.  
  269. Note: The size of the array varies based on the console, game, and sometimes scene. Use emu.getScreenSize() to get the screen's current dimensions.
  270. getScreenSize
  271.  
  272. Syntax
  273. emu.getScreenSize()
  274.  
  275. Parameters
  276. <none>
  277.  
  278. Return value
  279. Table - { width = int, height = int }
  280.  
  281. Description
  282. Returns a table containing the size of the console's current screen output.
  283. measureString
  284.  
  285. Syntax
  286. emu.measureString(text, maxWidth)
  287.  
  288. Parameters
  289. text - String
  290. String to measure
  291. maxWidth - Int (default: 0)
  292. Max width (pixels) - wraps to next line when reached
  293.  
  294. Return value
  295. Table - { width = int, height = int }
  296.  
  297. Description
  298. Measures the specified string and returns a table containing the width and height that the string would take when drawn.
  299. selectDrawSurface
  300.  
  301. Syntax
  302. emu.selectDrawSurface(surface, scale)
  303.  
  304. Parameters
  305. surface - Enum (drawSurface)
  306. Draw surface
  307. scale - Int (default: current scale)
  308. Scale to use for the "scriptHud" surface (max: 4)
  309.  
  310. Return value
  311. <none>
  312. 重试
  313.  
  314. 错误原因
  315.  
  316. Description
  317. Selects the surface on which any subsequent draw call will be drawn to.
  318.  
  319. consoleScreen: This surface is the same as the console's output and is a fixed resolution. Anything drawn here will appear in screenshots/videos.
  320.  
  321. scriptHud: This surface is independent to the console's output and has a configurable resolution. Drawings done on this surface will not appear in screenshots/videos.
  322.  
  323. Note: setScreenBuffer always draws to the "consoleScreen" surface.
  324. setScreenBuffer
  325.  
  326. Syntax
  327. emu.setScreenBuffer(screenBuffer)
  328.  
  329. Parameters
  330. screenBuffer - Array
  331. Array of integers in ARGB format
  332.  
  333. Return value
  334. <none>
  335.  
  336. Description
  337. Replaces the current frame with the contents of the specified array.
  338. Emulation
  339. breakExecution
  340.  
  341. Syntax
  342. emu.breakExecution()
  343.  
  344. Parameters
  345. <none>
  346.  
  347. Return value
  348. <none>
  349.  
  350. Description
  351. Breaks the execution.
  352. getState
  353.  
  354. Syntax
  355. emu.getState()
  356.  
  357. Parameters
  358. <none>
  359.  
  360. Return value
  361. Table - Content varies for each console and game.
  362.  
  363. Description
  364. Returns a table containing key-value pairs that describe the console's current state.
  365.  
  366. Note: The name of the values returned may change from one version to another. Some values may represent the emulator's internal state and may not be useful (these will be hidden in future versions.)
  367. reset
  368.  
  369. Syntax
  370. emu.reset()
  371.  
  372. Parameters
  373. <none>
  374.  
  375. Return value
  376. <none>
  377.  
  378. Description
  379. Resets the current game. If the console does not have a reset button, this will have the same effect as power cycling.
  380. resume
  381.  
  382. Syntax
  383. emu.resume()
  384.  
  385. Parameters
  386. 重试
  387.  
  388.  
  389. 错误原因
  390. <none>
  391.  
  392. Return value
  393. <none>
  394.  
  395. Description
  396. Resumes execution after a break.
  397. rewind
  398.  
  399. Syntax
  400. emu.rewind(seconds)
  401.  
  402. Parameters
  403. seconds - Int
  404. Number of seconds to rewind
  405.  
  406. Return value
  407. <none>
  408.  
  409. Description
  410. Instantly rewinds the emulation by the number of seconds specified.
  411.  
  412. Note: This can only be called from inside an "exec" memory callback.
  413. setState
  414.  
  415. Syntax
  416. emu.setState(state)
  417.  
  418. Parameters
  419. state - Table
  420. A key-value table containing the state to be applied.
  421.  
  422. Return value
  423. <none>
  424.  
  425. Description
  426. Changes the state of the emulator to match the values provided in the "state" parameter.
  427.  
  428. Note: The name of the values returned may change from one version to another. Some values may represent the emulator's internal state and should not be changed (access to these will be removed in future versions.)
  429. step
  430.  
  431. Syntax
  432. emu.step(count, stepType, cpuType)
  433.  
  434. Parameters
  435. count - Int
  436. Number of cycles/frames/etc.
  437. stepType - Enum (stepType)
  438. Step type
  439. cpuType - Enum (cpuType) (default: main CPU)
  440. CPU type
  441.  
  442. Return value
  443. <none>
  444.  
  445. Description
  446. Breaks the emulation's execution when the step conditions are reached.
  447. stop
  448.  
  449. Syntax
  450. emu.stop(exitCode)
  451.  
  452. Parameters
  453. exitCode - Int
  454. The exit code that the Mesen process will return.
  455.  
  456. Return value
  457. <none>
  458.  
  459. Description
  460. Stops the emulation and returns the specified exit code (when used with the --testRunner command line option).
  461. Input
  462. getInput
  463.  
  464. Syntax
  465. emu.getInput(port, subPort)
  466.  
  467. Parameters
  468. port - Int
  469. Port number
  470. subPort - Int (default: 0)
  471. Subport number - this is used for multitap-like adapters.
  472.  
  473. Return value
  474. Table - Content varies based on controller type.
  475.  
  476. Description
  477. Returns a table containing the state of all buttons for the selected port/controller. The table's content varies based on the controller type.
  478. getMouseState
  479.  
  480. Syntax
  481. emu.getMouseState()
  482.  
  483. Parameters
  484. <none>
  485.  
  486. Return value
  487. Table - { x = int, y = int, relativeX = int, relativeY = int, left = bool, middle = bool, right = bool }
  488.  
  489. Description
  490. Returns a table containing the position and the state of all 3 buttons.
  491. isKeyPressed
  492.  
  493. Syntax
  494. emu.isKeyPressed(keyName)
  495.  
  496. Parameters
  497. keyName - String
  498. Name of the key to check
  499.  
  500. Return value
  501. Bool - The key's state (true when pressed)
  502.  
  503. Description
  504. Returns whether or not a specific key is pressed. The "keyName" must be the same as the string shown in the UI when the key is bound to a button.
  505. setInput
  506.  
  507. Syntax
  508. emu.setInput(input, port, subPort)
  509.  
  510. Parameters
  511. input - Table
  512. Controller state to apply to the port, same format as the return value of getInput().
  513. port - Int
  514. Port number
  515. subPort - Int (default: 0)
  516. Subport number - this is used for multitap-like adapters.
  517.  
  518. Return value
  519. <none>
  520.  
  521. Description
  522. Sets the input state for the specified port. Buttons enabled or disabled via setInput will keep their state until the next inputPolled event.
  523.  
  524. Note: If a button's value is not specified in the "input" argument, then the player retains control of that button. For example, "emu.setInput({ select = false, start = false }, 0)" will prevent the player 1 from using both the start and select buttons, but all other buttons will still work as normal.
  525.  
  526. It is recommended to use this function within a callback for the inputPolled event. Otherwise, the inputs may not be applied before the ROM has the chance to read them.
  527. Logging
  528. displayMessage
  529.  
  530. Syntax
  531. emu.displayMessage(category, text)
  532.  
  533. Parameters
  534. category - String
  535. The category is the portion shown between brackets
  536. text - String
  537. Text to show on the screen
  538.  
  539. Return value
  540. <none>
  541.  
  542. Description
  543. Displays a message on the main window in the format "[category] text"
  544. getLogWindowLog
  545.  
  546. Syntax
  547. emu.getLogWindowLog()
  548.  
  549. Parameters
  550. <none>
  551.  
  552. Return value
  553. String - A string containing the log shown in the log window
  554.  
  555. Description
  556. Returns the same text as what is shown in the emulator's log window.
  557. log
  558.  
  559. Syntax
  560. emu.log(text)
  561.  
  562. Parameters
  563. text - String
  564. Text to log
  565.  
  566. Return value
  567. <none>
  568.  
  569. Description
  570. Logs the specified string in the script's log window - useful for debugging scripts.
  571. Memory Access
  572. convertAddress
  573.  
  574. Syntax
  575. emu.convertAddress(address, memoryType, cpuType)
  576.  
  577. Parameters
  578. address - Int
  579. Address to convert
  580. memoryType - Enum (memType) (default: main CPU memory)
  581. Memory type
  582. cpuType - Enum (cpuType) (default: main CPU)
  583. CPU used for the conversion
  584.  
  585. Return value
  586. Table - { address = int, memType = enum }
  587.  
  588. Description
  589. Converts an address between CPU addressing mode and ROM/RAM addressing mode.
  590. When a ROM/RAM address is given, a CPU address matching that value is returned, if the address is mapped.
  591. When a CPU address is given, the corresponding ROM/RAM address is returned, if the address is mapped to ROM/RAM.
  592. getLabelAddress
  593.  
  594. Syntax
  595. emu.getLabelAddress(label)
  596.  
  597. Parameters
  598. label - String
  599. Label
  600.  
  601. Return value
  602. Table - { address = int, memType = int }
  603.  
  604. Note: Returns nil when the specified label could not be found.
  605.  
  606. Description
  607. Returns a table containing the address and memory type for the specified label.
  608. getMemorySize
  609.  
  610. Syntax
  611. emu.getMemorySize(memoryType)
  612.  
  613. Parameters
  614. memoryType - Enum (memType)
  615. Memory type
  616.  
  617. Return value
  618. Int - Size of the specified memory type
  619.  
  620. Description
  621. Returns the size (in bytes) of the specified memory type.
  622. read
  623.  
  624. Syntax
  625. emu.read(address, memoryType, signed)
  626.  
  627. Parameters
  628. address - Int
  629. Address to read from
  630. memoryType - Enum (memType)
  631. Memory type to read from
  632. signed - Bool
  633. When true, the return value is an 8-bit signed value.
  634.  
  635. Return value
  636. Int - An 8-bit (signed or unsigned) value.
  637.  
  638. Description
  639. Reads an 8-bit value from the specified address and memory type.
  640.  
  641. Note: When using "memType.[cpuName]" memory types, side-effects can occur from reading a value. Use the "memType.[cpuName]Debug" enum values to avoid side-effects.
  642. read16
  643.  
  644. Syntax
  645. emu.read16(address, memoryType, signed)
  646.  
  647. Parameters
  648. address - Int
  649. Address to read from
  650. memoryType - Enum (memType)
  651. Memory type to read from
  652. signed - Bool
  653. When true, the return value is a 16-bit signed value.
  654.  
  655. Return value
  656. Int - A 16-bit (signed or unsigned) value.
  657.  
  658. Description
  659. Reads a 16-bit value from the specified address and memory type.
  660.  
  661. Note: When using "memType.[cpuName]" memory types, side-effects can occur from reading a value. Use the "memType.[cpuName]Debug" enum values to avoid side-effects.
  662. read32
  663.  
  664. Syntax
  665. emu.read32(address, memoryType, signed)
  666.  
  667. Parameters
  668. address - Int
  669. Address to read from
  670. memoryType - Enum (memType)
  671. Memory type to read from
  672. signed - Bool
  673. When true, the return value is a 32-bit signed value.
  674.  
  675. Return value
  676. Int - A 32-bit (signed or unsigned) value.
  677.  
  678. Description
  679. Reads a 32-bit value from the specified address and memory type.
  680.  
  681. Note: When using "memType.[cpuName]" memory types, side-effects can occur from reading a value. Use the "memType.[cpuName]Debug" enum values to avoid side-effects.
  682. write
  683.  
  684. Syntax
  685. emu.write(address, value, memoryType)
  686.  
  687. Parameters
  688. address - Int
  689. Address to write to
  690. value - Int
  691. 8-bit value to write
  692. memoryType - Enum (memType)
  693. Memory type to write to
  694.  
  695. Return value
  696. <none>
  697.  
  698. Description
  699. Writes an 8-bit value to the specified address and memory type.
  700.  
  701. Note: When using "memType.[cpuName]" memory types, side-effects can occur from writing a value. Use the "memType.[cpuName]Debug" enum values to avoid side-effects.
  702. write16
  703.  
  704. Syntax
  705. emu.write16(address, value, memoryType)
  706.  
  707. Parameters
  708. address - Int
  709. Address to write to
  710. value - Int
  711. 16-bit value to write
  712. memoryType - Enum (memType)
  713. Memory type to write to
  714.  
  715. Return value
  716. <none>
  717.  
  718. Description
  719. Writes a 16-bit value to the specified address and memory type.
  720.  
  721. Note: When using "memType.[cpuName]" memory types, side-effects can occur from writing a value. Use the "memType.[cpuName]Debug" enum values to avoid side-effects.
  722. write32
  723.  
  724. Syntax
  725. emu.write32(address, value, memoryType)
  726.  
  727. Parameters
  728. address - Int
  729. Address to write to
  730. value - Int
  731. 32-bit value to write
  732. memoryType - Enum (memType)
  733. Memory type to write to
  734.  
  735. Return value
  736. <none>
  737.  
  738. Description
  739. Writes a 32-bit value to the specified address and memory type.
  740.  
  741. Note: When using "memType.[cpuName]" memory types, side-effects can occur from writing a value. Use the "memType.[cpuName]Debug" enum values to avoid side-effects.
  742. Miscellaneous
  743. Access Counters
  744. getAccessCounters
  745.  
  746. Syntax
  747. emu.getAccessCounters(counterType, memoryType)
  748.  
  749. Parameters
  750. counterType - Enum (counterType)
  751. Counter type
  752. memoryType - Enum (memType)
  753. Memory type
  754.  
  755. Return value
  756. Array - Array of ints
  757.  
  758. Description
  759. Returns an array of access counters for the specified memory and operation types.
  760. resetAccessCounters
  761.  
  762. Syntax
  763. emu.resetAccessCounters()
  764.  
  765. Parameters
  766. <none>
  767.  
  768. Return value
  769. <none>
  770.  
  771. Description
  772. Resets all access counters.
  773. Cheats
  774. addCheat
  775.  
  776. Syntax
  777. emu.addCheat(cheatType, cheatCode)
  778.  
  779. Parameters
  780. cheatType - Enum (cheatType)
  781. Cheat type/format
  782. cheatCode - String
  783. Cheat code
  784.  
  785. Return value
  786. <none>
  787.  
  788. Description
  789. Adds the specified cheat code.
  790.  
  791. Note: Cheat codes added via this function are not permanent and not visible in the UI.
  792. clearCheats
  793.  
  794. Syntax
  795. emu.clearCheats()
  796.  
  797. Parameters
  798. <none>
  799.  
  800. Return value
  801. <none>
  802.  
  803. Description
  804. Removes all active cheat codes.
  805.  
  806. Note: This has no impact on cheat codes saved in the UI, but it will disable them temporarily.
  807. Save States
  808. createSavestate
  809.  
  810. Syntax
  811. emu.createSavestate()
  812.  
  813. Parameters
  814. <none>
  815.  
  816. Return value
  817. String - Binary string containing the savestate.
  818.  
  819. Description
  820. Creates a savestate and returns it as a binary string.
  821.  
  822. Note: This can only be called from inside an "exec" memory callback.
  823. loadSavestate
  824.  
  825. Syntax
  826. emu.loadSavestate(state)
  827.  
  828. Parameters
  829. state - String
  830. Binary data containing the savestate
  831.  
  832. Return value
  833. <none>
  834.  
  835. Description
  836. Loads a savestate from a binary string.
  837.  
  838. Note: This can only be called from inside an "exec" memory callback.
  839. Others
  840. getRomInfo
  841.  
  842. Syntax
  843. emu.getRomInfo()
  844.  
  845. Parameters
  846. <none>
  847.  
  848. Return value
  849. Table - { name = string, path = string, fileSha1Hash = string }
  850.  
  851. Description
  852. Returns information about the ROM file that is currently running.
  853. getScriptDataFolder
  854.  
  855. Syntax
  856. emu.getScriptDataFolder()
  857.  
  858. Parameters
  859. <none>
  860.  
  861. Return value
  862. String - The folder's path
  863.  
  864. Description
  865. This function returns the path to a unique folder (based on the script's filename) where the script should store its data (if any data needs to be saved). The data will be saved in subfolders inside the LuaScriptData folder in Mesen's home folder.
  866.  
  867. Note: This function will return an empty string if the "Allow access to I/O and OS functions" option is disabled.
  868. takeScreenshot
  869.  
  870. Syntax
  871. emu.takeScreenshot()
  872.  
  873. Parameters
  874. <none>
  875.  
  876. Return value
  877. String - A binary string containing a PNG image.
  878.  
  879. Description
  880. Takes a screenshot and returns a PNG file as a string. The screenshot is not saved to the disk.
  881. Enums
  882. callbackType
  883.  
  884. Syntax
  885. emu.callbackType.[value]
  886.  
  887. Description
  888. Used by emu.addMemoryCallback() and emu.removeMemoryCallback()
  889.  
  890. Values
  891. read - Callback is called when data is read
  892. write - Callback is called when data is written
  893. exec - Callback is called when the CPU starts executing an instruction
  894. cheatType
  895.  
  896. Syntax
  897. emu.cheatType.[value]
  898.  
  899. Description
  900. Used by emu.addCheat()
  901.  
  902. Values
  903. nesGameGenie - Game Genie (NES)
  904. nesProActionRocky - Pro Action Rocky (NES)
  905. nesCustom - Custom Address:Value code (NES)
  906. gbGameGenie - Game Genie (GB)
  907. gbGameShark - Game Shark (GB)
  908. snesGameGenie - Game Genie (SNES)
  909. snesProActionReplay - Pro Action Replay (SNES)
  910. pceRaw - 24-bit address format (PC Engine)
  911. pceAddress - 21-bit address format (PC Engine)
  912. smsProActionReplay - Pro Action Replay (SMS)
  913. smsGameGenie - Game Genie (SMS)
  914. counterType
  915.  
  916. Syntax
  917. emu.counterType.[value]
  918.  
  919. Description
  920. Used by emu.getAccessCounters()
  921.  
  922. Values
  923. readCount - Returns the number of times each byte was read
  924. writeCount - Returns the number of times each byte was written
  925. execCount - Returns the number of times each byte was executed
  926. lastReadClock - Returns the time at which each byte was last read
  927. lastWriteClock - Returns the time at which each byte was last written
  928. lastExecClock - Returns the time at which each byte was last executed
  929. cpuType
  930.  
  931. Syntax
  932. emu.cpuType.[value]
  933.  
  934. Description
  935. Used by several APIs to specify which CPU the API call applies to.
  936.  
  937. Values
  938. snes - SNES - Main CPU - S-CPU 5A22 (65186)
  939. spc - SNES - SPC
  940. necDsp - SNES - DSP-n
  941. sa1 - SNES - SA-1
  942. cx4 - SNES - CX4
  943. gameboy - Game Boy - Main CPU (can also be used in SGB mode)
  944. nes - NES - Main CPU - 2A03 (6502)
  945. pce - PC Engine - Main CPU - HuC6280
  946. sms - SMS - Main CPU - Z80
  947. gba - GBA - Main CPU - ARM7TDMI
  948. drawSurface
  949.  
  950. Syntax
  951. emu.drawSurface.[value]
  952.  
  953. Description
  954. Used by emu.selectDrawSurface() and emu.getDrawSurfaceSize()
  955.  
  956. Values
  957. consoleScreen - Console's framebuffer. Drawings appear in screenshots/videos.
  958. scriptHud - Separate surface with a configurable resolution. Drawings not shown in screenshots/videos.
  959. eventType
  960.  
  961. Syntax
  962. emu.eventType.[value]
  963.  
  964. Description
  965. Used by emu.addEventCallback() and emu.removeEventCallback()
  966.  
  967. Values
  968. nmi - Triggered when an NMI occurs (not available on some consoles)
  969. irq - Triggered when an IRQ occurs
  970. startFrame - Triggered when a frame starts (typically once vertical blank ends)
  971. endFrame - Triggered when a frame ends (typically once vertical blank starts)
  972. reset - Triggered when the console is reset (not available on some consoles)
  973. scriptEnded - Triggered when the Lua script is stopped
  974. inputPolled - Triggered after the emulator updates the state of all input devices (once per frame)
  975. stateLoaded - Triggered when a savestate is manually loaded
  976. stateSaved - Triggered when a savestate is manually saved
  977. codeBreak - Triggered when code execution breaks (e.g breakpoint, step, etc.)
  978. memType
  979.  
  980. Syntax
  981. emu.memType.[value]
  982.  
  983. Description
  984. Used by several APIs to specify which memory type to access/use.
  985.  
  986. Values
  987. snesMemory - SNES - S-CPU memory
  988. spcMemory - SNES - SPC memory
  989. sa1Memory - SNES - SA-1 memory
  990. necDspMemory - SNES - DSP-n memory
  991. gsuMemory - SNES - GSU memory
  992. cx4Memory - SNES - CX4 memory
  993. gameboyMemory - Game Boy - CPU memory
  994. nesMemory - NES - CPU memory
  995. nesPpuMemory - NES - PPU memory
  996. pceMemory - PC Engine - CPU memory
  997. smsMemory - SMS - CPU memory
  998. gbaMemory - GBA - CPU memory
  999. snesDebug - SNES - S-CPU memory (no read/write side-effects)
  1000. spcDebug - SNES - SPC memory (no read/write side-effects)
  1001. sa1Debug - SNES - SA-1 memory (no read/write side-effects)
  1002. necDspDebug - SNES - DSP-n memory (no read/write side-effects)
  1003. gsuDebug - SNES - GSU memory (no read/write side-effects)
  1004. cx4Debug - SNES - CX4 memory (no read/write side-effects)
  1005. gameboyDebug - Game Boy - CPU memory (no read/write side-effects)
  1006. nesDebug - NES - CPU memory (no read/write side-effects)
  1007. nesPpuDebug - NES - PPU memory (no read/write side-effects)
  1008. pceDebug - PC Engine - CPU memory (no read/write side-effects)
  1009. smsDebug - SMS - CPU memory (no read/write side-effects)
  1010. gbaDebug - GBA - CPU memory (no read/write side-effects)
  1011. snesPrgRom - SNES - PRG ROM
  1012. snesWorkRam - SNES - Work RAM
  1013. snesSaveRam - SNES - Save RAM
  1014. snesVideoRam - SNES - Video RAM
  1015. snesSpriteRam - SNES - Sprite RAM (OAM)
  1016. snesCgRam - SNES - Palette RAM (CGRAM)
  1017. spcRam - SNES - SPC - RAM
  1018. spcRom - SNES - SPC - IPL ROM
  1019. dspProgramRom - SNES - DSP-n - Program ROM
  1020. dspDataRom - SNES - DSP-n - Data ROM
  1021. dspDataRam - SNES - DSP-n - Data RAM
  1022. sa1InternalRam - SNES - SA-1 - IRAM
  1023. gsuWorkRam - SNES - GSU - Work RAM
  1024. cx4DataRam - SNES - CX4 - Data RAM
  1025. bsxPsRam - SNES - BS-X - PSRAM
  1026. bsxMemoryPack - SNES - BS-X - Memory Pack
  1027. gbPrgRom - Game Boy - PRG ROM
  1028. gbWorkRam - Game Boy - Work RAM
  1029. gbCartRam - Game Boy - Cart/Save RAM
  1030. gbHighRam - Game Boy - High RAM
  1031. gbBootRom - Game Boy - Boot ROM
  1032. gbVideoRam - Game Boy - Video RAM
  1033. gbSpriteRam - Game Boy - Sprite RAM
  1034. nesPrgRom - NES - PRG ROM
  1035. nesInternalRam - NES - System RAM
  1036. nesWorkRam - NES - Work RAM
  1037. nesSaveRam - NES - Save RAM
  1038. nesNametableRam - NES - Nametable RAM (CIRAM)
  1039. nesSpriteRam - NES - Sprite RAM (OAM)
  1040. nesSecondarySpriteRam - NES - Secondary Sprite RAM
  1041. nesPaletteRam - NES - Palette RAM
  1042. nesChrRam - NES - CHR RAM
  1043. nesChrRom - NES - CHR ROM
  1044. pcePrgRom - PC Engine - HuCard ROM
  1045. pceWorkRam - PC Engine - Work RAM
  1046. pceSaveRam - PC Engine - Save RAM
  1047. pceCdromRam - PC Engine - CD-ROM Unit RAM
  1048. pceCardRam - PC Engine - Card RAM
  1049. pceAdpcmRam - PC Engine - ADPCM RAM
  1050. pceArcadeCardRam - PC Engine - Arcade Card RAM
  1051. pceVideoRam - PC Engine - Video RAM (VDC)
  1052. pceVideoRamVdc2 - PC Engine - Video RAM (VDC2 - SuperGrafx only)
  1053. pceSpriteRam - PC Engine - Sprite RAM (VDC)
  1054. pceSpriteRamVdc2 - PC Engine - Sprite RAM (VDC2 - SuperGrafx only)
  1055. pcePaletteRam - PC Engine - Palette RAM (VCE)
  1056. smsPrgRom - SMS - ROM
  1057. smsWorkRam - SMS - System RAM
  1058. smsCartRam - SMS - Cart RAM
  1059. smsBootRom - SMS - BIOS ROM
  1060. smsVideoRam - SMS - Video RAM
  1061. smsPaletteRam - SMS - Palette RAM
  1062. smsPort - SMS - I/O Port
  1063. gbaPrgRom - GBA - ROM
  1064. gbaIntWorkRam - GBA - Internal Work RAM
  1065. gbaExtWorkRam - GBA - External Work RAM
  1066. gbaSaveRam - GBA - Save RAM/Flash/EEPROM
  1067. gbaBootRom - GBA - BIOS ROM
  1068. gbaVideoRam - GBA - Video RAM
  1069. gbaSpriteRam - GBA - Sprite RAM
  1070. gbaPaletteRam - GBA - Palette RAM
  1071. stepType
  1072.  
  1073. Syntax
  1074. emu.stepType.[value]
  1075.  
  1076. Description
  1077. Used by emu.step()
  1078.  
  1079. Values
  1080. step - Steps the specified number of instructions
  1081. stepOut - Steps out of the current subroutine (not available for all CPUs)
  1082. stepOver - Steps over the current subroutine call (not available for all CPUs)
  1083. cpuCycleStep - Steps the specified number of CPU cycles (not available for all CPUs)
  1084. ppuStep - Steps the specified number of scanline cycles
  1085. ppuScanline - Steps the specified number of scanlines
  1086. ppuFrame - Steps the specified number of video frames
  1087. specificScanline - Breaks on the specified scanline number
  1088. runToNmi - Breaks on the next NMI event
  1089. runToIrq - Breaks on the next IRQ event
  1090.  
  1091. --NES游戏似乎不支持read16,read32,write16,write32.
  1092.  
  1093. read / readWord
  1094.  
  1095. Syntax
  1096.  
  1097. emu.read(address, type, signed = false)
  1098. emu.readWord(address, type, signed = false)
  1099.  
  1100. Parameters
  1101. address - Integer The address/offset to read from.
  1102. type - Enum The type of memory to read from. See memType.
  1103. signed - (optional) Boolean If true, the value returned will be interpreted as a signed value.
  1104.  
  1105. Return value
  1106. An 8-bit (read) or 16-bit (readWord) value.
  1107.  
  1108. Description
  1109. Reads a value from the specified memory type.
  1110.  
  1111. When calling read / readWord with the memType.cpu or memType.ppu memory types, emulation side-effects may occur.
  1112. To avoid triggering side-effects, use the memType.cpuDebug or memType.ppuDebug types, which will not cause side-effects.
  1113. write / writeWord
  1114.  
  1115. Syntax
  1116.  
  1117. emu.write(address, value, type)
  1118. emu.writeWord(address, value, type)
  1119.  
  1120. Parameters
  1121. address - Integer The address/offset to write to.
  1122. value - Integer The value to write.
  1123. type - Enum The type of memory to write to. See memType.
  1124.  
  1125. Return value
  1126. None
  1127.  
  1128. Description
  1129. Writes an 8-bit or 16-bit value to the specified memory type.
  1130.  
  1131. Normally read-only types such as PRG-ROM or CHR-ROM can be written to when using memType.prgRom or memType.chrRom.
  1132. Changes will remain in effect until a power cycle occurs.
  1133. To revert changes done to ROM, see revertPrgChrChanges.
  1134.  
  1135. When calling write / writeWord with the memType.cpu or memType.ppu memory types, emulation side-effects may occur.
  1136. To avoid triggering side-effects, use the memType.cpuDebug or memType.ppuDebug types, which will not cause side-effects.
  1137. revertPrgChrChanges
  1138.  
  1139. Syntax
  1140.  
  1141. emu.revertPrgChrChanges()
  1142.  
  1143. Return value
  1144. None
  1145.  
  1146. Description
  1147. Reverts all modifications done to PRG-ROM and CHR-ROM via write/writeWord calls.
  1148. getPrgRomOffset
  1149.  
  1150. Syntax
  1151.  
  1152. emu.getPrgRomOffset(address)
  1153.  
  1154. Parameters
  1155. address - Integer A CPU address (Valid range: $0000-$FFFF)
  1156.  
  1157. Return value
  1158. Integer The corresponding byte offset in PRG ROM
  1159.  
  1160. Description
  1161. Returns an integer representing the byte offset of the specified CPU address in PRG ROM based on the mapper’s current configuration. Returns -1 when the specified address is not mapped to PRG ROM.(Mesen2.x已弃用)
  1162. getChrRomOffset
  1163.  
  1164. Syntax
  1165.  
  1166. emu.getChrRomOffset(address)
  1167.  
  1168. Parameters
  1169. address - Integer A PPU address (Valid range: $0000-$3FFF)
  1170.  
  1171. Return value
  1172. Integer The corresponding byte offset in CHR ROM
  1173.  
  1174. Description
  1175. Returns an integer representing the byte offset of the specified PPU address in CHR ROM based on the mapper’s current configuration. Returns -1 when the specified address is not mapped to CHR ROM.(Mesen2.x已弃用)
  1176. getLabelAddress
  1177.  
  1178. Syntax
  1179.  
  1180. emu.getLabelAddress(label)
  1181.  
  1182. Parameters
  1183. label - String The label to look up
  1184.  
  1185. Return value
  1186. Integer The corresponding CPU address
  1187.  
  1188. Description
  1189. Returns the address of the specified label. This address can be used with the memory read/write functions (read(), readWord(), write(), writeWord()) using the emu.memType.cpu or emu.memType.cpuDebug memory types.
Advertisement
Comments
  • adrianytania
    172 days
    # CSS 0.78 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://rawtext.host/raw?44lh4m
    4.  
    5. This made me $13,000 in 2 days.
    6.  
    7. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 38% — they will simply correct the exchange rate.
    8. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    9.  
    10. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without any verification from Swapzone — instant swap).
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
  • User was banned
Add Comment
Please, Sign In to add comment