Memory card read-write method, gamepad and game system

By recognizing and processing the memory card commands of the mobile terminal through the game controller, write protection of the memory card is achieved, which solves the problem of file corruption during high-frequency hot-swapping of memory cards, ensuring data security and a plug-and-play experience.

CN123157130APending Publication Date: 2026-11-24NO 4 HOST TECHNOLOGY (CHENGDU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611237897.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-14
Publication Date
2026-11-24

Smart Images

  • Figure CN123157130A_ABST
    Figure CN123157130A_ABST
Patent Text Reader

Abstract

This application relates to the field of game controller technology, and discloses a memory card read / write method, a game controller, and a game system. The method includes: receiving a memory card command sent by a mobile terminal, wherein the memory card command is sent by the mobile terminal in response to a read / write operation on the memory card; determining whether the memory card command is a write command or a read command; if the memory card command is a write command, then in response to the write command, receiving the write data corresponding to the write command sent by the mobile terminal, and invalidating the write data to prevent the write data from being written to the memory card. Through the above method, this application improves the security of memory card data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of game controller technology, specifically to a memory card reading and writing method, a game controller, and a game system. Background Technology

[0002] With the improvement of mobile device performance, mobile gaming has become one of the mainstream forms of entertainment. To enhance the control experience, mobile game controllers, which are clip-on controllers that connect directly to mobile devices such as mobile phones and tablets via USB-C interfaces, are widely used. Typically, these game controllers only function as HID (Human Interface Device), with game content relying on the phone's local storage or downloaded from the network. However, large, high-quality games are bulky, not only taking a long time to download but also consuming a lot of phone storage space.

[0003] To address this, existing technologies have proposed combining a memory card with a game controller. The memory card containing game data is inserted into the game controller's slot, and the mobile device, after authentication, can directly read and run the game data from the memory card on the game controller. However, mobile game controllers are typically used in a plug-and-play, hot-swappable manner. In this high-frequency hot-swapping scenario, where the USB connection is easily disconnected from the game controller at any time, the memory card's file allocation table or directory structure is highly susceptible to corruption, leading to the loss of all data on the card. Summary of the Invention

[0004] In view of the above problems, this application provides a memory card read / write method, a game controller, and a game system, which improves the security of memory card data.

[0005] According to one aspect of the embodiments of this application, a memory card read / write method is provided. The method is applied to a game controller, which is connected to a mobile terminal and a memory card. The method includes: receiving a memory card command sent by the mobile terminal, wherein the memory card command is sent by the mobile terminal in response to a read / write operation on the memory card; determining whether the memory card command is a write command or a read command; if the memory card command is a write command, then in response to the write command, receiving write data corresponding to the write command sent by the mobile terminal; and invalidating the write data to prevent the write data from being written to the memory card.

[0006] In an alternative approach, after invalidating the written data, the method further includes: returning a status instruction indicating that the write operation is complete to the mobile terminal, the status instruction indicating that the memory card is in a readable and writable state.

[0007] In an alternative approach, after determining whether the memory card command is a write command or a read command, the method further includes: if the memory card command is a read command, then reading the stored data in the memory card according to the read command; and sending the read stored data to the mobile terminal.

[0008] In one alternative approach, the read command includes a read instruction and a read address; reading the stored data in the memory card according to the read command further includes: sending the read command to the memory card so that the memory card responds to the read instruction and returns the stored data corresponding to the read address.

[0009] In one alternative approach, invalidating the written data may further include: overwriting or discarding the written data, or releasing the storage space for caching the written data.

[0010] In one optional embodiment, the memory card includes a first storage area and a second storage area. The first storage area is used to store game data, and the second storage area is used to store management data corresponding to the game data. When the memory card command is a write command, the method further includes: identifying the storage area of ​​the write data corresponding to the write command based on the write command; when the storage area of ​​the write data is the first storage area, after receiving the write data corresponding to the write command sent by the mobile terminal, performing a step of invalidating the write data to prevent the write data from being written to the memory card; when the storage area of ​​the write data is the second storage area, after receiving the write data corresponding to the write command sent by the mobile terminal, writing the write data to the second storage area of ​​the memory card.

[0011] In one alternative approach, the game controller connects to a mobile terminal via a first interface, the first interface including a first communication channel and a second communication channel; receiving a memory card command sent by the mobile terminal further includes: receiving the memory card command sent by the mobile terminal and identifying the communication channel through which the memory card command is received; when the memory card command is received through the first communication channel, receiving write data corresponding to a write command sent by the mobile terminal further includes: receiving write data corresponding to a write command sent by the mobile terminal through the first communication channel; performing a step of invalidating the write data to prevent the write data from being written to the memory card; when the memory card command is received through the second communication channel, receiving write data corresponding to a write command sent by the mobile terminal further includes: receiving write data corresponding to a write command sent by the mobile terminal through the second communication channel, the write data received through the second communication channel being management data corresponding to the storage data in the memory card, and sent by the mobile terminal in response to an operation on the mobile terminal's application; writing the write data to the memory card within a preset time window.

[0012] In one alternative approach, the mobile terminal supplies power to the game controller via the power pin of the first interface; and writes the data to the memory card within a preset time window. The method further includes: during the process of writing the data to the memory card within the preset time window, detecting the voltage of the power pin in real time; determining whether the voltage is less than a preset voltage threshold; if the voltage is lower than the preset voltage threshold, activating the power-down protection capacitor to supply power to the game controller and the memory card until the data is successfully written to the memory card, and then stopping the power-down protection capacitor from supplying power to the memory card.

[0013] According to another aspect of the embodiments of this application, a game controller is provided, including a first interface, a second interface, and a controller. The controller is connected to a mobile terminal and a memory card through the first interface and the second interface, respectively. The controller stores a computer program and executes the computer program to implement the memory card read / write method provided in any of the above embodiments.

[0014] According to another aspect of the embodiments of this application, a game system is provided, including a mobile terminal, a memory card, and a game controller provided in the above embodiments; the mobile terminal is used to hide a write button in the display interface when connected to a controller through a first interface; the write button is used to send a memory card command to the game controller after being triggered.

[0015] In this embodiment, when the game controller is connected to a mobile terminal, it can identify whether the memory card command sent by the mobile terminal is a write command or a read command. This allows it to determine whether the mobile terminal needs to read data from the memory card or write data to it. Therefore, when the mobile terminal is writing data to the memory card, the controller can receive the write data sent by the mobile terminal. Then, by directly invalidating the write data instead of sending it to the memory card, write data can be prevented from being written to the memory card. In this way, the memory card is never written to, even in high-frequency hot-swapping scenarios. Write protection of the memory card can be achieved without relying on the user's active memory or operation. This ensures that the memory card's file system is never corrupted, and disconnecting the USB connection at any time will not damage the memory card's file system, thus improving the security of the data stored on the memory card.

[0016] The above description is merely an overview of the technical solutions of the embodiments of this application. In order to better understand the technical means of the embodiments of this application and to implement them in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the embodiments of this application more obvious and understandable, specific implementation methods of this application are described below. Attached Figure Description

[0017] The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings: Figure 1 A schematic diagram of the hardware architecture of the game controller provided in an embodiment of this application is shown; Figure 2 A flowchart illustrating the memory card read / write method provided in an embodiment of this application is shown. Figure 3 A schematic diagram of the structure of the game system provided in an embodiment of this application is shown; Figure 4 A schematic diagram of the structure of the game controller provided in an embodiment of this application is shown. Detailed Implementation

[0018] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein.

[0019] To avoid prolonged game downloads and excessive storage space consumption on mobile phones, existing technologies have proposed solutions that combine memory cards with game controllers. For example, a USB hybrid device architecture combines a USB hub, HID device, and USB Mass Storage Class (MSC) card reader. In this architecture, the memory card is typically exposed directly to the mobile terminal's operating system in a standard MSC device form, with read / write permissions entirely controlled by the operating system. In this architecture, the game controller integrates a memory card slot. After inserting the memory card containing game data into the slot, the mobile terminal, after authentication, can directly read and run the game data from the memory card on the game controller.

[0020] However, in the above solutions, firstly, since mobile game controllers are generally used in a plug-and-play, unplug-and-play manner, it is normal behavior for users to directly unplug the USB connection at any time to disconnect from the game controller, rather than an abnormal operation, and this cannot be eliminated through user education. Secondly, in the operating systems of mainstream mobile terminals, third-party applications typically lack the permission to perform unloading operations or buffer write-back operations on external storage volumes, meaning that reliable and secure memory card ejection cannot be achieved at the software level.

[0021] Secondly, to store high-definition game resources exceeding 4GB per file and ensure cross-platform compatibility, memory cards typically employ the exFAT (Extended File Allocation Table) file system. Unlike file systems with journaling mechanisms, the exFAT file system has extremely low tolerance for unexpected power outages during the write process. During gameplay, even if the mobile application performs zero writes to the memory card, the mobile operating system will still automatically perform some write operations on the memory card. These operations include generating thumbnail caches for images and videos, updating metadata such as mount counts and last access times of the storage volume. These operations mean that the memory card's file system cache always contains data that has not yet been written to disk—i.e., dirty data. In the aforementioned hot-swappable scenario, the memory card's file allocation table or directory structure is highly susceptible to corruption due to the presence of dirty data, leading to the loss of all data on the card.

[0022] Secondly, while full-size memory cards can have write protection enabled via a physical write-protection slider, some memory cards lack this slider in their physical design. Adding a manual write-protection switch to a game controller not only increases hardware costs and the risk of mechanical failure, but also relies on the user's active memorization and operation, contradicting the need for plug-and-play convenience. Furthermore, if the user forgets to switch the write-protection switch back on, the memory card will be damaged during hot-swapping.

[0023] To address the aforementioned issues, this application provides a memory card read / write method for the game controller. When the game controller is connected to a mobile terminal, and the mobile terminal writes data to the memory card via the game controller, the game controller does not send the written data to the memory card for storage. Instead, it directly invalidates the written data sent by the mobile terminal, preventing the data from being written to the memory card. In this way, no data is written to the memory card at either the electrical or protocol levels. Even in high-frequency hot-swapping scenarios, write protection of the memory card can be achieved without relying on the user's active memory or operation. This ensures that the memory card's file system is always free of corrupted data, and disconnecting the USB connection at any time will not damage the memory card's file system, thus improving the security of the data stored on the memory card.

[0024] The hardware architecture of the game controller will be introduced first. Figure 1 A schematic diagram of the hardware architecture of the game controller provided in an embodiment of this application is shown, as follows: Figure 1 As shown, the game controller 10 includes a controller 11, a first interface 12, and a second interface 13. The controller 11 is connected to the mobile terminal 30 and the memory card 20 through the first interface 12 and the second interface 13, respectively.

[0025] In this embodiment, the game controller 10 can be configured as a clamping structure, which is securely clamped to the back or side of the mobile terminal.

[0026] The controller 11 can be a microcontroller unit (MCU) or a card reader control chip. The uplink port of the controller 11 is connected to the mobile terminal 30 through the first interface 12, and is responsible for exchanging communication protocols with the mobile terminal 30. The downlink port is connected to the memory card 20 through the second interface 13, and is responsible for managing the low-level read and write operations of the memory card 20.

[0027] The first interface 12 can be a universal serial bus interface, such as a USB Type-C interface. The first interface 12 is used not only to transmit button input signals generated by the game controller, but also to transmit data exchange signals between the mobile terminal 30 and the memory card 20. When the game controller 10 is inserted into the mobile terminal 30 through the first interface 12, the controller 11 sends an enumeration signal to the mobile terminal 30 through the first interface 12, enabling the mobile terminal 30 to recognize the game controller 10.

[0028] The second interface 13 can be a card slot located on the game controller's casing. When the user inserts the memory card 20 into this slot, the controller 11 can communicate with the memory card 20. The controller 11 can send read / write commands and clock signals to the memory card 20 through the second interface 13, and receive data returned by the memory card 20.

[0029] The memory card 20 can be an SD card, TF card, miniSD card, NAND flash memory card, or UFS memory card, etc.

[0030] The mobile terminal 30 can be a smartphone or a tablet computer. The mobile terminal 30 runs an operating system that can manage the external game controller 10 through the first interface 12. In the usage scenario of this application, the mobile terminal 30 acts as a host device, sending memory card commands to the game controller 10 to perform read and write operations on the memory card 20.

[0031] Figure 2 A flowchart of a memory card read / write method provided in an embodiment of this application is shown. The method comprises... Figure 1 The controller 11 of the gamepad 10 performs the operation. For example... Figure 2 As shown, the method includes the following steps: Step 100: Receive the memory card command sent by the mobile terminal. The memory card command is sent by the mobile terminal in response to read and write operations on the memory card.

[0032] In this embodiment of the application, at the communication protocol level, the mobile terminal's operating system recognizes the memory card as a USB mass storage device. When it is necessary to read game data from the memory card or write data to the memory card, it sends a memory card command to the game controller through the USB transmission control protocol.

[0033] The memory card command can be a write command or a read command. The write command instructs the mobile terminal to write data to the memory card, and can specifically include a write instruction and a write address. The write instruction can be set to WRITE(10), and the write address is the address where the data to be written is stored in the memory card. The read command instructs the mobile terminal to read data stored in the memory card, and can specifically include a read instruction and a read address. The read instruction can be set to READ(10), and the read address is the address where the data to be read is stored in the memory card.

[0034] When a user needs to read game data from the memory card or cache game data to the memory card, the user can perform read and write operations on the memory card through the mobile terminal. Therefore, in response to the user's read and write operation on the memory card triggered on the mobile terminal, the mobile terminal sends a memory card command to the game controller through the first interface.

[0035] When a memory card is attached to a mobile device via a game controller, the mobile device's operating system can automatically extract image or video frames from the memory card, generate thumbnails, and update the memory card with these thumbnails. This allows the mobile device to directly read the thumbnails from the memory card, improving the speed at which users browse images or videos. Therefore, during gameplay, the mobile device can also respond to its own operating system's write operations to the memory card by sending memory card commands to the game controller via the first interface.

[0036] When the mobile terminal's operating system needs to update metadata such as the memory card's mount count or last access time, the mobile terminal can also respond to its own operating system's write operation on the memory card by sending a memory card command to the game controller through the first interface.

[0037] Step 200: Determine whether the memory card command is a write command or a read command.

[0038] In this embodiment of the application, the controller of the game controller can logically identify the memory card command to determine whether the memory card command is a write command or a read command. For example, when the controller recognizes that the memory card command includes the write instruction WRITE(10), it can determine that the memory card command is a write command; when the controller recognizes that the memory card command includes the read instruction READ(10), it can determine that the memory card command is a read command.

[0039] When the controller determines that the memory card command is a read command, it can ascertain that the mobile terminal needs to read the stored data on the memory card. At this point, the controller can read the stored data from the memory card according to the read command and send the read data to the mobile terminal. This allows the mobile terminal to load and run the data from the memory card, ensuring that the user can normally play games or browse files stored on the memory card.

[0040] Specifically, the controller can send a read command to the memory card through the second interface, so that the memory card responds to the read instruction in the read command, packages the storage data corresponding to the read address in the read command, and sends the packaged storage data to the controller. The controller then sends the storage data to the mobile terminal, so that the mobile terminal can accurately read the game data in the memory card and run it.

[0041] When the controller determines that the storage command is a write command, it can ascertain that the mobile terminal intends to write data to the memory card. At this point, the controller will execute step 300.

[0042] Step 300: If the memory card command is a write command, then in response to the write command, receive the write data corresponding to the write command sent by the mobile terminal.

[0043] Specifically, according to the USB MSC protocol, the mobile terminal first sends a write command to the game controller, and then sends the data to be written to the memory card to the game controller. After the controller determines that the memory card command is a write command, it can determine that the mobile terminal is about to send write data, and thus receive the write data sent by the mobile terminal.

[0044] Preferably, after receiving the write data, the game controller can send an ACK signal to the mobile terminal through the first interface to notify the mobile terminal that the write data has been successfully delivered. This avoids the mobile terminal from judging the game controller as faulty due to the lack of response, popping up an error message, or even refusing to mount the memory card, thus affecting the user's gaming experience.

[0045] Step 400: Invalidate the written data to prevent it from being written to the memory card.

[0046] After receiving the write data, the game controller does not perform the operation of writing the write data to the memory card. That is, the controller will not send the write data to the memory card through the second interface, nor will it drive the write data signal on the memory card bus.

[0047] Preferably, after receiving the write data, the controller can discard it. Specifically, the controller can first temporarily store the write data in an internal buffer, and then directly clear the internal buffer, or no longer retain the pointer to the write data. In this case, the internal buffer is released, and the write data is lost.

[0048] In some embodiments, the controller can also overwrite the written data after receiving it. For example, the controller can first write the written data to one of its memory addresses, and then write other data to that memory address, so that the other data overwrites the written data. Of course, the current written data can also be overwritten using the next write data sent by the mobile terminal.

[0049] In other embodiments, after the controller writes the write data to one of its memory addresses, it can release the storage space that caches the write data so that the controller can subsequently cache subsequent received write data or other data into that storage space.

[0050] Through the methods described above, the controller can intercept write data at the controller side, preventing it from being written to the memory card. This allows the mobile terminal to read data normally from the memory card, while write data sent by the mobile terminal is intercepted and not written to the memory card. Therefore, during gameplay, the mobile terminal can load and run game data from the memory card normally, as data written by the mobile terminal is intercepted at the game controller side. Since no data is actually written to the memory card at the electrical and protocol levels, the memory card's file system contains no corrupted data, and its file allocation table and directory structure remain consistent. Therefore, even if the user suddenly removes the mobile terminal, the memory card's file allocation table and directory structure will not be corrupted.

[0051] Preferably, when the memory card is removed from the slot of the game controller and connected to the computer via a card reader, the computer can normally read the stored data in the memory card and write data to the memory card, allowing the user to update the game data in the memory card via the computer.

[0052] In summary, in this embodiment, when the game controller is connected to a mobile terminal, it can determine whether the memory card command sent by the mobile terminal is a write command or a read command by identifying whether the mobile terminal needs to read data from the memory card or write data to the memory card. Therefore, when the mobile terminal is writing data to the memory card, the controller can receive the write data sent by the mobile terminal. Then, by directly invalidating the write data instead of sending it to the memory card, write data can be prevented from being written to the memory card. In this way, the memory card is never written to, and even in high-frequency hot-swapping scenarios, write protection of the memory card can be achieved without relying on the user's active memory or operation. This ensures that the memory card's file system is never corrupted, and disconnecting the USB connection at any time will not cause damage to the memory card's file system, thus improving the security of the data stored on the memory card.

[0053] In existing technology, when a physical write-protect switch is triggered, the game controller typically returns a write-protection error status code to the mobile terminal if the write-protection switch is detected. However, some mobile terminal operating systems, upon receiving such a status code, will take defensive measures to prevent file system inconsistencies. These measures may include automatically remounting the memory card in read-only mode or even directly stopping access to the memory card, prompting the user that the memory card is damaged or needs to be checked for errors. This prevents the user from properly reading game data from the memory card through the mobile terminal, severely impacting the plug-and-play experience of the game controller.

[0054] In this embodiment of the application, in order to avoid the above-mentioned problems, after invalidating the written data, the controller of the game controller can generate a status instruction that the writing operation is completed and return the status instruction that the writing operation is completed to the mobile terminal, wherein the status instruction is used to indicate that the memory card is in a readable and writable state.

[0055] The status instruction can include a status code field and the status value corresponding to that status code field. For example, a status value of 0x00 indicates that the write operation is complete.

[0056] After receiving the status command, the mobile terminal can confirm that the write operation to the memory card has been successfully executed, and can continue to write data to the memory card. Of course, in the embodiment where the mobile terminal reads the stored data in the memory card, after the controller sends the packaged stored data to the mobile terminal, it will also send a status command indicating that the read operation is complete, so that the mobile terminal can confirm that the read operation to the memory card has been successfully executed.

[0057] Therefore, the mobile terminal can determine that the memory card is a read / write device and will not change the memory card's mounting attributes, ensuring that the memory card always appears as a normally writable storage device in the mobile terminal's user interface and operating system background. This allows users to normally read game data from the memory card when using a game controller, guaranteeing a plug-and-play experience.

[0058] Please continue reading. Figure 1 The memory card 20 may include a first storage area 21 and a second storage area 22.

[0059] The first storage area 21 is the main storage space for storing core game content, used to store game data and other core data, such as game image files, high-definition textures, audio materials, video resources, and other large-capacity data. Game data can be pre-written by the game publisher or user when the memory card is connected to a computer via a card reader, characterized by large data volume, low write frequency, and high read frequency. During game operation, the mobile terminal primarily reads data from the first storage area. In this case, prohibiting any write operations to the first storage area prevents data loss due to hot-swapping, ensuring a smooth gaming experience for the user.

[0060] The second storage area 22 is used to store management data corresponding to the game data. This management data can include metadata such as game list indexes, content manifest files, user configuration files, game save indexes, and media scan suppression files. This data helps the accompanying application on the mobile terminal to quickly locate and verify game content. Compared to the first storage area 21, the second storage area 22 has a smaller data volume. Furthermore, since damage to the management data can be repaired by regeneration or reconfiguration without causing the loss of core game content in the first storage area 21, the second storage area 22 can allow limited write operations to improve the efficiency of subsequent loading of game data on the mobile terminal and ensure a smooth gaming experience for the user.

[0061] Based on this, after determining that the memory card command is a write command, the game controller can first identify the storage area of ​​the data to be written corresponding to the write command. Specifically, the game controller can determine the storage area of ​​the data to be written by the write address in the write command, thereby determining whether the mobile terminal needs to write the data to the first storage area or the second storage area.

[0062] When the storage area for writing data is the first storage area, after the game controller receives the write command corresponding to the write data sent by the mobile terminal, it executes step 400 to prevent any data from being written to the first storage area, thus ensuring the security of the game data in the first storage area.

[0063] When the storage area for the written data is the second storage area, after the game controller receives the write data corresponding to the write command sent by the mobile terminal, it can write the write data to the second storage area of ​​the memory card through the second interface, thereby updating the data in the second storage area.

[0064] In this way, by preventing writes to the first storage area while allowing writes to the second storage area, on the one hand, even if the management data in the second storage area is damaged in a high-frequency hot-swapping scenario, the core game content in the first storage area will not be damaged. On the other hand, by preserving the mobile terminal's ability to dynamically maintain the management data corresponding to the game data, it is possible to avoid the loss of functionality or errors in the application on the mobile terminal due to the lack of management data, thus ensuring the user's gaming experience.

[0065] In this embodiment of the application, the first interface may include a first communication channel and a second communication channel, wherein the first communication channel may be a conventional data read / write channel, such as a batch transmission channel; and the second communication channel may be a custom transmission channel, such as an HID Feature Report channel.

[0066] Typically, to manage game data stored on a memory card, users can be provided with a path to update the management data on the memory card via a mobile application, enhancing the user's gaming experience. In this case, to facilitate the game controller's differentiation between user-permitted write operations to the memory card, the mobile terminal's write operation to the memory card via the first communication channel can be considered a disallowed write operation, while the mobile terminal's write operation to the memory card via the second communication channel when the user sends management data to the game controller via the mobile application can be considered a permitted write operation.

[0067] When the mobile terminal sends a memory card command to the game controller via the first communication channel, the memory card command may include a field for identifying the first communication channel. When the mobile terminal sends a memory card command to the game controller via the second communication channel, the memory card command may include a field for identifying the second channel. Thus, upon receiving a memory card command from the mobile terminal, the game controller can identify the communication channel through the identification field, thereby determining the communication channel through which the mobile terminal sent the memory card command.

[0068] When a memory card command is received via the first communication channel, it means that the mobile terminal may subsequently read game data from the memory card or write data to the memory card. In this case, after the game controller determines that the memory card command is a write command, in response to the write command, the game controller receives the write data corresponding to the write command sent by the mobile terminal via the first communication channel, and then executes step 400 to prevent any data from being written to the memory card, thereby improving the security of the memory card data.

[0069] When a memory card command is received via the second communication channel, it means the user may subsequently read or write management data to the memory card using a companion application on the mobile terminal. In this case, when the game controller determines the memory card command is a write command, it can determine that the mobile terminal will respond to the user's operation on the mobile terminal's application by sending write data to the game controller via the second channel. This write data is the management data corresponding to the stored data on the memory card. Thus, in response to this write command, the game controller can receive the management data corresponding to the write command sent by the mobile terminal via the second communication channel.

[0070] Because game controllers are at risk of being hot-swapped at any time, even writing management data to a memory card can lead to corruption of the memory card's file system if a power outage occurs during the writing process.

[0071] To address this, considering the relatively small volume of management data, a time window control mechanism can be introduced. Once the data to be written to the memory card is determined to be management data, the game controller will write the data to the memory card within a preset time window, completing the writing process within that window. The time window can be set to 100ms or 500ms to ensure that management data can be written to the memory card quickly, reducing the probability of the game controller being hot-swapped during the writing process and improving the data security of the memory card.

[0072] After the game controller is connected to the mobile terminal via the first interface, the mobile terminal can supply power to the game controller through the power pin of the first interface to maintain the normal operation of the game controller. Under normal circumstances, the voltage of the power pin is greater than or equal to 4.5V. When the game controller is hot-plugged, the supply voltage of the power pin gradually decreases and may even drop to 0V. By detecting the voltage of the power pin in real time, the game controller's controller can determine whether the game controller is being hot-plugged.

[0073] To prevent data corruption due to hot-swapping when management data is written to the memory card, the voltage of the power supply pin can be monitored in real time during the writing process within a preset time window. Then, it is determined whether each detected voltage is less than a preset voltage threshold, which can be set to 4.5V.

[0074] When the voltage is greater than or equal to the preset voltage threshold, it indicates that the game controller has not been hot-plugged, the memory card will not be damaged due to data being written, and the game controller will not perform any operation. When the voltage is less than the preset voltage threshold, it indicates that the user is unplugging the game controller. At this time, the game controller can activate its own power-loss protection capacitor to supply power to the game controller and memory card, allowing the game controller to continue writing management data to the memory card until the data is successfully written to the memory card, at which point the power-loss protection capacitor stops supplying power to the memory card.

[0075] By writing all management data to the memory card through the game controller and then stopping power to the memory card, it is ensured that there is no dirty data in the memory card's file system, eliminating the risk of inconsistent data in the memory card's file system due to a sudden power outage of the game controller, and improving the data security of the memory card.

[0076] Figure 3 A schematic diagram of the structure of the game system provided in an embodiment of this application is shown, such as... Figure 3 As shown, the game system 1 includes a mobile terminal 30, a memory card 20, and a game controller 10.

[0077] In the prior art, when the mobile terminal 30 is connected to the game controller 10, the display interface of the mobile terminal 30 usually displays a write button. When the write button is triggered, the mobile terminal 30 sends a memory card command to the game controller 10 to write data to the memory card 20.

[0078] In this embodiment of the application, in order to further realize write protection of the memory card, when the mobile terminal 30 is connected to the controller 11 through the first interface 12, the write button can be hidden in the display interface of the accompanying application, so as to guide the user to connect the memory card 20 to the computer using a card reader, and then update the game data in the memory card 20 through the computer.

[0079] In other embodiments, the application on the mobile terminal 30 can read the volume dirty flag in the file system of the memory card 20 each time the memory card is mounted, and then determine whether the file system of the memory card 20 is complete through the volume dirty flag. For example, when the volume dirty flag is 0, it means that the file system structure is complete; when the volume dirty flag is 1, it means that the file system may be inconsistent. In this case, the application can prompt the user to repair the memory card 20.

[0080] After confirming the integrity of the file system on memory card 20 using the dirty file system flag, a consistency check can be performed on critical files within memory card 20. If the check fails, it indicates that the core data on memory card 20 may have been corrupted due to hot-swapping the game controller, prompting the user to repair memory card 20. If all critical files on memory card 20 pass the check, it indicates that the core data on memory card 20 is not corrupted, and the game data on memory card 20 can be read and run normally.

[0081] Figure 4 The diagram shows a schematic of the game controller provided in an embodiment of this application. The specific implementation of the game controller is not limited by the specific embodiments of this application.

[0082] like Figure 4 As shown, the game controller 10 may include a controller 302, wherein the controller 302 stores a computer program 304, and the computer program 304 may include computer-executable instructions.

[0083] The controller 302 is used to execute the computer program 304 to implement the above-described memory card read / write method embodiment.

[0084] This application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described storage card read / write method embodiment.

[0085] This application provides a computer program that can be executed by a processor to implement the above-described memory card read / write method embodiments.

[0086] This application provides a computer program product, which includes a computer program that, when executed by a processor, implements the above-described memory card read / write method embodiment.

[0087] In the several embodiments provided in this application, any function, if implemented as a software functional module / unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, part or all of the technical solutions of this application can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or other electronic device) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing computer program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0088] The algorithms or displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, the embodiments of this application are not directed to any particular programming language. It should be understood that the content of this application described herein can be implemented using various programming languages, and the above description of specific languages ​​is for the purpose of disclosing the best mode of implementation of this application.

[0089] It should be noted that the above embodiments are illustrative of this application and not restrictive, and those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. This application can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In claims enumerating several means, several units or modules of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be construed as limiting the order of execution.

[0090] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for reading and writing a memory card, characterized in that, This method is applied to a game controller, which is connected to a mobile terminal and a memory card respectively. The method includes: Receive a memory card command sent by a mobile terminal, wherein the memory card command is sent by the mobile terminal in response to a read / write operation on the memory card; Determine whether the memory card command is a write command or a read command; If the memory card command is a write command, then in response to the write command, the write data corresponding to the write command sent by the mobile terminal is received; The written data is invalidated to prevent it from being written to the memory card.

2. The method according to claim 1, characterized in that, After invalidating the written data, the method further includes: The system returns a status command indicating that the write operation is complete to the mobile terminal. This status command is used to indicate that the memory card is in a readable and writable state.

3. The method according to claim 1, characterized in that, After determining whether the memory card command is a write command or a read command, the method further includes: If the memory card command is the read command, then the stored data in the memory card is read according to the read command; The read and stored data is sent to the mobile terminal.

4. The method according to claim 3, characterized in that, The read command includes a read instruction and a read address; The step of reading the stored data in the memory card according to the read command further includes: The read command is sent to the memory card so that the memory card responds to the read command and returns the stored data corresponding to the read address.

5. The method according to any one of claims 1 to 4, characterized in that, The invalidation process for the written data further includes: The written data may be overwritten or discarded, or the storage space used to cache the written data may be released.

6. The method according to claim 1, characterized in that, The storage card includes a first storage area and a second storage area, wherein the first storage area is used to store game data and the second storage area is used to store management data corresponding to the game data; When the memory card command is the write command, the method further includes: The storage area for the write data corresponding to the write command is identified based on the write command. When the storage area of ​​the written data is the first storage area, after receiving the write data corresponding to the write command sent by the mobile terminal, the step of invalidating the written data is performed to prevent the written data from being written to the memory card. When the storage area for the written data is the second storage area, after receiving the write data corresponding to the write command sent by the mobile terminal, the write data is written to the second storage area of ​​the memory card.

7. The method according to claim 1, characterized in that, The game controller is connected to the mobile terminal via a first interface, the first interface including a first communication channel and a second communication channel; The step of receiving the memory card command sent by the mobile terminal further includes: Receive the memory card command sent by the mobile terminal and identify the communication channel for receiving the memory card command; When the memory card command is received through the first communication channel, receiving the write data corresponding to the write command sent by the mobile terminal further includes: receiving the write data corresponding to the write command sent by the mobile terminal through the first communication channel; Perform the step of invalidating the written data to prevent the written data from being written to the memory card; When the memory card command is received through the second communication channel, receiving the write data corresponding to the write command sent by the mobile terminal further includes: receiving the write data corresponding to the write command sent by the mobile terminal through the second communication channel, wherein the write data received through the second communication channel is management data corresponding to the storage data in the memory card, and is sent by the mobile terminal in response to the operation of the mobile terminal's application. The data is written to the memory card within a preset time window.

8. The method according to claim 7, characterized in that, The mobile terminal supplies power to the game controller through the power pin of the first interface; The step of writing the data to the memory card within a preset time window further includes: During the process of writing the data to the memory card within the preset time window, the voltage of the power supply pin is detected in real time. Determine whether the voltage is less than a preset voltage threshold; If the voltage is lower than the preset voltage threshold, the power-down protection capacitor is activated to supply power to the game controller and the memory card until the data is successfully written to the memory card, at which point the power-down protection capacitor stops supplying power to the memory card.

9. A game controller, characterized in that, The game controller includes a first interface, a second interface, and a controller. The controller is connected to the mobile terminal and the memory card through the first interface and the second interface, respectively. The controller stores a computer program, and the controller executes the computer program to implement the memory card read / write method as described in any one of claims 1 to 8.

10. A game system, characterized in that, The game system includes a mobile terminal, a memory card, and a game controller as described in claim 9; The mobile terminal is used to hide the write button in the display interface when connected to the controller through the first interface; When the write button is triggered, the mobile terminal sends a memory card command to the game controller.